diff options
author | Fred Drake <fdrake@acm.org> | 2004-08-03 18:53:07 +0000 |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2004-08-03 18:53:07 +0000 |
commit | edcac8f416ebe4561bbc0e91c46a3bfc5457f73c (patch) | |
tree | df4fbed36f3dfc843a735183c440453be3eb6a05 | |
parent | 1fa649f2d5d4a63105577888830276a6dc4771b5 (diff) | |
download | cpython-git-edcac8f416ebe4561bbc0e91c46a3bfc5457f73c.tar.gz |
make sure distutils logging is shut off in tests to avoid spurious output
-rw-r--r-- | Lib/distutils/log.py | 3 | ||||
-rw-r--r-- | Lib/distutils/tests/support.py | 13 | ||||
-rw-r--r-- | Lib/distutils/tests/test_build_py.py | 4 | ||||
-rw-r--r-- | Lib/distutils/tests/test_build_scripts.py | 4 | ||||
-rw-r--r-- | Lib/distutils/tests/test_install_scripts.py | 4 |
5 files changed, 25 insertions, 3 deletions
diff --git a/Lib/distutils/log.py b/Lib/distutils/log.py index 024e7c28de..bf26302fcc 100644 --- a/Lib/distutils/log.py +++ b/Lib/distutils/log.py @@ -50,7 +50,10 @@ error = _global_log.error fatal = _global_log.fatal def set_threshold(level): + # return the old threshold for use from tests + old = _global_log.threshold _global_log.threshold = level + return old def set_verbosity(v): if v <= 0: diff --git a/Lib/distutils/tests/support.py b/Lib/distutils/tests/support.py index cef985d79a..475ceee598 100644 --- a/Lib/distutils/tests/support.py +++ b/Lib/distutils/tests/support.py @@ -3,6 +3,19 @@ import shutil import tempfile +from distutils import log + + +class LoggingSilencer(object): + + def setUp(self): + super(LoggingSilencer, self).setUp() + self.threshold = log.set_threshold(log.FATAL) + + def tearDown(self): + log.set_threshold(self.threshold) + super(LoggingSilencer, self).tearDown() + class TempdirManager(object): """Mix-in class that handles temporary directories for test cases. diff --git a/Lib/distutils/tests/test_build_py.py b/Lib/distutils/tests/test_build_py.py index 6f7276866d..78e4c55ed4 100644 --- a/Lib/distutils/tests/test_build_py.py +++ b/Lib/distutils/tests/test_build_py.py @@ -9,7 +9,9 @@ from distutils.core import Distribution from distutils.tests import support -class BuildPyTestCase(support.TempdirManager, unittest.TestCase): +class BuildPyTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def test_package_data(self): sources = self.mkdtemp() diff --git a/Lib/distutils/tests/test_build_scripts.py b/Lib/distutils/tests/test_build_scripts.py index 7ef71cc120..bf25b38222 100644 --- a/Lib/distutils/tests/test_build_scripts.py +++ b/Lib/distutils/tests/test_build_scripts.py @@ -9,7 +9,9 @@ from distutils.core import Distribution from distutils.tests import support -class BuildScriptsTestCase(support.TempdirManager, unittest.TestCase): +class BuildScriptsTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def test_default_settings(self): cmd = self.get_build_scripts_cmd("/foo/bar", []) diff --git a/Lib/distutils/tests/test_install_scripts.py b/Lib/distutils/tests/test_install_scripts.py index 2e86dcd8a9..fffa6ef2c3 100644 --- a/Lib/distutils/tests/test_install_scripts.py +++ b/Lib/distutils/tests/test_install_scripts.py @@ -9,7 +9,9 @@ from distutils.core import Distribution from distutils.tests import support -class InstallScriptsTestCase(support.TempdirManager, unittest.TestCase): +class InstallScriptsTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def test_default_settings(self): dist = Distribution() |