(original) (raw)

changeset: 99086:7411830c7b24 branch: 3.5 parent: 99080:2c9b5c5b54ae parent: 99084:4461613ffe78 user: Serhiy Storchaka storchaka@gmail.com date: Thu Nov 12 19:47:14 2015 +0200 files: Lib/test/test_shutil.py description: Issue #25607: Restore old distutils logging threshold after running tests that parse command line arguments. diff -r 2c9b5c5b54ae -r 7411830c7b24 Lib/distutils/tests/test_core.py --- a/Lib/distutils/tests/test_core.py Thu Nov 12 13:15:56 2015 +0200 +++ b/Lib/distutils/tests/test_core.py Thu Nov 12 19:47:14 2015 +0200 @@ -9,6 +9,7 @@ from test.support import captured_stdout, run_unittest import unittest from distutils.tests import support +from distutils import log # setup script that uses __file__ setup_using___file__ = """\ @@ -36,6 +37,7 @@ self.old_stdout = sys.stdout self.cleanup_testfn() self.old_argv = sys.argv, sys.argv[:] + self.addCleanup(log.set_threshold, log._global_log.threshold) def tearDown(self): sys.stdout = self.old_stdout diff -r 2c9b5c5b54ae -r 7411830c7b24 Lib/distutils/tests/test_dist.py --- a/Lib/distutils/tests/test_dist.py Thu Nov 12 13:15:56 2015 +0200 +++ b/Lib/distutils/tests/test_dist.py Thu Nov 12 19:47:14 2015 +0200 @@ -13,6 +13,7 @@ from test.support import TESTFN, captured_stdout, run_unittest from distutils.tests import support +from distutils import log class test_dist(Command): @@ -405,6 +406,7 @@ def test_show_help(self): # smoke test, just makes sure some help is displayed + self.addCleanup(log.set_threshold, log._global_log.threshold) dist = Distribution() sys.argv = [] dist.help = 1 diff -r 2c9b5c5b54ae -r 7411830c7b24 Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py Thu Nov 12 13:15:56 2015 +0200 +++ b/Lib/test/test_shutil.py Thu Nov 12 19:47:14 2015 +0200 @@ -1037,7 +1037,7 @@ # now create another tarball using `tar` tarball2 = os.path.join(root_dir, 'archive2.tar') tar_cmd = ['tar', '-cf', 'archive2.tar', base_dir] - with support.change_cwd(root_dir), captured_stdout(): + with support.change_cwd(root_dir): spawn(tar_cmd) self.assertTrue(os.path.isfile(tarball2)) /storchaka@gmail.com