STINNER Victor added the comment: Instead of a context manager, why not adding a addCleanup() in setUp() method of test cases?
You might also add a "resource" test in regrtest, but this one might be overkill, since tests using distutils are known (test_distutils), no? Lib/distutils/tests/support.py: + threshold = log.set_threshold(log.WARN) + log.set_threshold(threshold) + yield threshold I would prefer to have a log.get_threshold() function (or log._get_threshold() if you don't want to modify the public API), or even read log._global_log.threshold. test_shutil.py: - with support.change_cwd(root_dir), captured_stdout(): + with support.change_cwd(root_dir): Why do you remove captured_stdout() here? ---------- nosy: +haypo _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25607> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com