[Python-checkins] distutils2: Rename tests.support.LoggingSilencer to LoggingCatcher.

tarek.ziade python-checkins at python.org
Thu Aug 19 08:34:14 CEST 2010


tarek.ziade pushed d11ef3c75e6f to distutils2:

http://hg.python.org/distutils2/rev/d11ef3c75e6f
changeset:   584:d11ef3c75e6f
user:        ?ric Araujo <merwok at netwok.org>
date:        Sun Aug 15 04:02:25 2010 +0200
summary:     Rename tests.support.LoggingSilencer to LoggingCatcher.
files:       src/distutils2/tests/support.py, src/distutils2/tests/test_bdist_dumb.py, src/distutils2/tests/test_bdist_msi.py, src/distutils2/tests/test_bdist_wininst.py, src/distutils2/tests/test_build.py, src/distutils2/tests/test_build_clib.py, src/distutils2/tests/test_build_ext.py, src/distutils2/tests/test_build_py.py, src/distutils2/tests/test_build_scripts.py, src/distutils2/tests/test_check.py, src/distutils2/tests/test_clean.py, src/distutils2/tests/test_config_cmd.py, src/distutils2/tests/test_depgraph.py, src/distutils2/tests/test_dist.py, src/distutils2/tests/test_install.py, src/distutils2/tests/test_install_data.py, src/distutils2/tests/test_install_distinfo.py, src/distutils2/tests/test_install_headers.py, src/distutils2/tests/test_install_lib.py, src/distutils2/tests/test_install_scripts.py, src/distutils2/tests/test_metadata.py, src/distutils2/tests/test_sdist.py

diff --git a/src/distutils2/tests/support.py b/src/distutils2/tests/support.py
--- a/src/distutils2/tests/support.py
+++ b/src/distutils2/tests/support.py
@@ -4,14 +4,14 @@
 (standard library unittest for 3.2 and higher, third-party unittest2
 release for older versions).
 
-Four helper classes are provided: LoggingSilencer, TempdirManager,
+Four helper classes are provided: LoggingCatcher, TempdirManager,
 EnvironGuard and WarningsCatcher. They are written to be used as mixins,
 e.g. ::
 
     from distutils2.tests.support import unittest
-    from distutils2.tests.support import LoggingSilencer
+    from distutils2.tests.support import LoggingCatcher
 
-    class SomeTestCase(LoggingSilencer, unittest.TestCase):
+    class SomeTestCase(LoggingCatcher, unittest.TestCase):
 
 If you need to define a setUp method on your test class, you have to
 call the mixin class' setUp method or it won't work (same thing for
@@ -44,11 +44,11 @@
     # external release of same package for older versions
     import unittest2 as unittest
 
-__all__ = ['LoggingSilencer', 'WarningsCatcher', 'TempdirManager',
+__all__ = ['LoggingCatcher', 'WarningsCatcher', 'TempdirManager',
            'EnvironGuard', 'DummyCommand', 'unittest']
 
 
-class LoggingSilencer(object):
+class LoggingCatcher(object):
     """TestCase-compatible mixin to catch logging calls.
 
     Every log message that goes through distutils2.log will get appended to
@@ -58,7 +58,7 @@
     """
 
     def setUp(self):
-        super(LoggingSilencer, self).setUp()
+        super(LoggingCatcher, self).setUp()
         self.threshold = log.set_threshold(FATAL)
         # when log is replaced by logging we won't need
         # such monkey-patching anymore
@@ -69,7 +69,7 @@
     def tearDown(self):
         log.set_threshold(self.threshold)
         log.Log._log = self._old_log
-        super(LoggingSilencer, self).tearDown()
+        super(LoggingCatcher, self).tearDown()
 
     def _log(self, level, msg, args):
         if level not in (DEBUG, INFO, WARN, ERROR, FATAL):
@@ -93,6 +93,13 @@
         del self.logs[:]
 
 
+class LoggingSilencer(object):
+    "Class that raises an exception to make sure the renaming is noticed."
+
+    def __init__(self, *args):
+        raise DeprecationWarning("LoggingSilencer renamed to LoggingCatcher")
+
+
 class WarningsCatcher(object):
 
     def setUp(self):
diff --git a/src/distutils2/tests/test_bdist_dumb.py b/src/distutils2/tests/test_bdist_dumb.py
--- a/src/distutils2/tests/test_bdist_dumb.py
+++ b/src/distutils2/tests/test_bdist_dumb.py
@@ -27,7 +27,7 @@
 """
 
 class BuildDumbTestCase(support.TempdirManager,
-                        support.LoggingSilencer,
+                        support.LoggingCatcher,
                         support.EnvironGuard,
                         unittest.TestCase):
 
diff --git a/src/distutils2/tests/test_bdist_msi.py b/src/distutils2/tests/test_bdist_msi.py
--- a/src/distutils2/tests/test_bdist_msi.py
+++ b/src/distutils2/tests/test_bdist_msi.py
@@ -7,7 +7,7 @@
 from distutils2.tests.support import unittest
 
 class BDistMSITestCase(support.TempdirManager,
-                       support.LoggingSilencer,
+                       support.LoggingCatcher,
                        unittest.TestCase):
 
     @unittest.skipUnless(sys.platform == "win32", "runs only on win32")
diff --git a/src/distutils2/tests/test_bdist_wininst.py b/src/distutils2/tests/test_bdist_wininst.py
--- a/src/distutils2/tests/test_bdist_wininst.py
+++ b/src/distutils2/tests/test_bdist_wininst.py
@@ -7,7 +7,7 @@
 from distutils2.tests.support import unittest
 
 class BuildWinInstTestCase(support.TempdirManager,
-                           support.LoggingSilencer,
+                           support.LoggingCatcher,
                            unittest.TestCase):
 
     def test_get_exe_bytes(self):
diff --git a/src/distutils2/tests/test_build.py b/src/distutils2/tests/test_build.py
--- a/src/distutils2/tests/test_build.py
+++ b/src/distutils2/tests/test_build.py
@@ -11,7 +11,7 @@
     from distutils2._backport.sysconfig import get_platform
 
 class BuildTestCase(support.TempdirManager,
-                    support.LoggingSilencer,
+                    support.LoggingCatcher,
                     unittest.TestCase):
 
     def test_finalize_options(self):
diff --git a/src/distutils2/tests/test_build_clib.py b/src/distutils2/tests/test_build_clib.py
--- a/src/distutils2/tests/test_build_clib.py
+++ b/src/distutils2/tests/test_build_clib.py
@@ -9,7 +9,7 @@
 from distutils2.tests.support import unittest
 
 class BuildCLibTestCase(support.TempdirManager,
-                        support.LoggingSilencer,
+                        support.LoggingCatcher,
                         unittest.TestCase):
 
     def test_check_library_dist(self):
diff --git a/src/distutils2/tests/test_build_ext.py b/src/distutils2/tests/test_build_ext.py
--- a/src/distutils2/tests/test_build_ext.py
+++ b/src/distutils2/tests/test_build_ext.py
@@ -27,7 +27,7 @@
     return os.path.join(CURDIR, 'xxmodule.c')
 
 class BuildExtTestCase(support.TempdirManager,
-                       support.LoggingSilencer,
+                       support.LoggingCatcher,
                        unittest.TestCase):
     def setUp(self):
         # Create a simple test environment
diff --git a/src/distutils2/tests/test_build_py.py b/src/distutils2/tests/test_build_py.py
--- a/src/distutils2/tests/test_build_py.py
+++ b/src/distutils2/tests/test_build_py.py
@@ -13,7 +13,7 @@
 
 
 class BuildPyTestCase(support.TempdirManager,
-                      support.LoggingSilencer,
+                      support.LoggingCatcher,
                       unittest.TestCase):
 
     def test_package_data(self):
diff --git a/src/distutils2/tests/test_build_scripts.py b/src/distutils2/tests/test_build_scripts.py
--- a/src/distutils2/tests/test_build_scripts.py
+++ b/src/distutils2/tests/test_build_scripts.py
@@ -14,7 +14,7 @@
 
 
 class BuildScriptsTestCase(support.TempdirManager,
-                           support.LoggingSilencer,
+                           support.LoggingCatcher,
                            unittest.TestCase):
 
     def test_default_settings(self):
diff --git a/src/distutils2/tests/test_check.py b/src/distutils2/tests/test_check.py
--- a/src/distutils2/tests/test_check.py
+++ b/src/distutils2/tests/test_check.py
@@ -6,7 +6,7 @@
 from distutils2.tests.support import unittest
 from distutils2.errors import DistutilsSetupError
 
-class CheckTestCase(support.LoggingSilencer,
+class CheckTestCase(support.LoggingCatcher,
                     support.TempdirManager,
                     unittest.TestCase):
 
diff --git a/src/distutils2/tests/test_clean.py b/src/distutils2/tests/test_clean.py
--- a/src/distutils2/tests/test_clean.py
+++ b/src/distutils2/tests/test_clean.py
@@ -8,7 +8,7 @@
 from distutils2.tests.support import unittest
 
 class cleanTestCase(support.TempdirManager,
-                    support.LoggingSilencer,
+                    support.LoggingCatcher,
                     unittest.TestCase):
 
     def test_simple_run(self):
diff --git a/src/distutils2/tests/test_config_cmd.py b/src/distutils2/tests/test_config_cmd.py
--- a/src/distutils2/tests/test_config_cmd.py
+++ b/src/distutils2/tests/test_config_cmd.py
@@ -7,7 +7,7 @@
 from distutils2.tests.support import unittest
 from distutils2 import log
 
-class ConfigTestCase(support.LoggingSilencer,
+class ConfigTestCase(support.LoggingCatcher,
                      support.TempdirManager,
                      unittest.TestCase):
 
diff --git a/src/distutils2/tests/test_depgraph.py b/src/distutils2/tests/test_depgraph.py
--- a/src/distutils2/tests/test_depgraph.py
+++ b/src/distutils2/tests/test_depgraph.py
@@ -13,7 +13,7 @@
 except ImportError:
     import StringIO
 
-class DepGraphTestCase(support.LoggingSilencer,
+class DepGraphTestCase(support.LoggingCatcher,
                        unittest.TestCase):
 
     DISTROS_DIST = ('choxie', 'grammar', 'towel-stuff')
diff --git a/src/distutils2/tests/test_dist.py b/src/distutils2/tests/test_dist.py
--- a/src/distutils2/tests/test_dist.py
+++ b/src/distutils2/tests/test_dist.py
@@ -38,7 +38,7 @@
 
 
 class DistributionTestCase(support.TempdirManager,
-                           support.LoggingSilencer,
+                           support.LoggingCatcher,
                            support.EnvironGuard,
                            unittest.TestCase):
 
diff --git a/src/distutils2/tests/test_install.py b/src/distutils2/tests/test_install.py
--- a/src/distutils2/tests/test_install.py
+++ b/src/distutils2/tests/test_install.py
@@ -25,7 +25,7 @@
 
 class InstallTestCase(support.TempdirManager,
                       support.EnvironGuard,
-                      support.LoggingSilencer,
+                      support.LoggingCatcher,
                       unittest.TestCase):
 
     def test_home_installation_scheme(self):
diff --git a/src/distutils2/tests/test_install_data.py b/src/distutils2/tests/test_install_data.py
--- a/src/distutils2/tests/test_install_data.py
+++ b/src/distutils2/tests/test_install_data.py
@@ -8,7 +8,7 @@
 from distutils2.tests.support import unittest
 
 class InstallDataTestCase(support.TempdirManager,
-                          support.LoggingSilencer,
+                          support.LoggingCatcher,
                           support.EnvironGuard,
                           unittest.TestCase):
 
diff --git a/src/distutils2/tests/test_install_distinfo.py b/src/distutils2/tests/test_install_distinfo.py
--- a/src/distutils2/tests/test_install_distinfo.py
+++ b/src/distutils2/tests/test_install_distinfo.py
@@ -34,7 +34,7 @@
 
 
 class InstallDistinfoTestCase(support.TempdirManager,
-                              support.LoggingSilencer,
+                              support.LoggingCatcher,
                               support.EnvironGuard,
                               unittest.TestCase):
 
diff --git a/src/distutils2/tests/test_install_headers.py b/src/distutils2/tests/test_install_headers.py
--- a/src/distutils2/tests/test_install_headers.py
+++ b/src/distutils2/tests/test_install_headers.py
@@ -8,7 +8,7 @@
 from distutils2.tests.support import unittest
 
 class InstallHeadersTestCase(support.TempdirManager,
-                             support.LoggingSilencer,
+                             support.LoggingCatcher,
                              support.EnvironGuard,
                              unittest.TestCase):
 
diff --git a/src/distutils2/tests/test_install_lib.py b/src/distutils2/tests/test_install_lib.py
--- a/src/distutils2/tests/test_install_lib.py
+++ b/src/distutils2/tests/test_install_lib.py
@@ -16,7 +16,7 @@
     bytecode_support = False
 
 class InstallLibTestCase(support.TempdirManager,
-                         support.LoggingSilencer,
+                         support.LoggingCatcher,
                          support.EnvironGuard,
                          unittest.TestCase):
 
diff --git a/src/distutils2/tests/test_install_scripts.py b/src/distutils2/tests/test_install_scripts.py
--- a/src/distutils2/tests/test_install_scripts.py
+++ b/src/distutils2/tests/test_install_scripts.py
@@ -10,7 +10,7 @@
 
 
 class InstallScriptsTestCase(support.TempdirManager,
-                             support.LoggingSilencer,
+                             support.LoggingCatcher,
                              unittest.TestCase):
 
     def test_default_settings(self):
diff --git a/src/distutils2/tests/test_metadata.py b/src/distutils2/tests/test_metadata.py
--- a/src/distutils2/tests/test_metadata.py
+++ b/src/distutils2/tests/test_metadata.py
@@ -7,11 +7,11 @@
 from distutils2.metadata import (DistributionMetadata, _interpret,
                                  PKG_INFO_PREFERRED_VERSION)
 from distutils2.tests import run_unittest
-from distutils2.tests.support import unittest, LoggingSilencer
+from distutils2.tests.support import unittest, LoggingCatcher
 from distutils2.errors import (MetadataConflictError,
                                MetadataUnrecognizedVersionError)
 
-class DistributionMetadataTestCase(LoggingSilencer, unittest.TestCase):
+class DistributionMetadataTestCase(LoggingCatcher, unittest.TestCase):
 
     def test_instantiation(self):
         PKG_INFO = os.path.join(os.path.dirname(__file__), 'PKG-INFO')
diff --git a/src/distutils2/tests/test_sdist.py b/src/distutils2/tests/test_sdist.py
--- a/src/distutils2/tests/test_sdist.py
+++ b/src/distutils2/tests/test_sdist.py
@@ -58,7 +58,7 @@
 somecode%(sep)sdoc.txt
 """
 
-class SDistTestCase(support.TempdirManager, support.LoggingSilencer,
+class SDistTestCase(support.TempdirManager, support.LoggingCatcher,
                     support.EnvironGuard, unittest.TestCase):
 
     def setUp(self):

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list