]> granicus.if.org Git - python/commitdiff
Issue #25607: Restore old distutils logging threshold after running tests that
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 12 Nov 2015 17:46:23 +0000 (19:46 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 12 Nov 2015 17:46:23 +0000 (19:46 +0200)
parse command line arguments.

Lib/distutils/tests/test_core.py
Lib/distutils/tests/test_dist.py
Lib/test/test_shutil.py

index 0d979bcde9ebed887e90b57b63517f93c7405425..e6d4c9b3608ae4d2b2e477e2e0300af1cf5cd3d9 100644 (file)
@@ -9,6 +9,7 @@ import test.test_support
 from test.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 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase):
         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
index eb9b0ef262f46095688db75bc99003bd843143e5..378fe432b466bea1d102abe5de708e4012029ee5 100644 (file)
@@ -13,6 +13,7 @@ from distutils.cmd import Command
 import distutils.dist
 from test.test_support import TESTFN, captured_stdout, run_unittest, unlink
 from distutils.tests import support
+from distutils import log
 
 
 class test_dist(Command):
@@ -397,6 +398,7 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
 
     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
index c458c45dcb71ef2e02641b8d7f5f3f94c41aa1a3..f5adf994f1ac396a37b2ba26e490ea9528ba305d 100644 (file)
@@ -443,7 +443,7 @@ class TestShutil(unittest.TestCase):
         # 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))