]> granicus.if.org Git - python/commitdiff
Enable catching WARN-level logging messages in distutils' test_sdist
authorÉric Araujo <merwok@netwok.org>
Fri, 2 Sep 2011 22:28:43 +0000 (00:28 +0200)
committerÉric Araujo <merwok@netwok.org>
Fri, 2 Sep 2011 22:28:43 +0000 (00:28 +0200)
Lib/distutils/tests/test_sdist.py

index f34f786c92790de5cfaaee09a4de1b24ed8c0835..f9e28c8471a54b86e8dfc650886b9bdcbd4f2622 100644 (file)
@@ -78,9 +78,6 @@ class SDistTestCase(PyPIRCCommandTestCase):
         dist.include_package_data = True
         cmd = sdist(dist)
         cmd.dist_dir = 'dist'
-        def _warn(*args):
-            pass
-        cmd.warn = _warn
         return dist, cmd
 
     @unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run')
@@ -235,7 +232,8 @@ class SDistTestCase(PyPIRCCommandTestCase):
         # with the `check` subcommand
         cmd.ensure_finalized()
         cmd.run()
-        warnings = self.get_logs(WARN)
+        warnings = [msg for msg in self.get_logs(WARN) if
+                    msg.startswith('warning: check:')]
         self.assertEqual(len(warnings), 2)
 
         # trying with a complete set of metadata
@@ -244,7 +242,8 @@ class SDistTestCase(PyPIRCCommandTestCase):
         cmd.ensure_finalized()
         cmd.metadata_check = 0
         cmd.run()
-        warnings = self.get_logs(WARN)
+        warnings = [msg for msg in self.get_logs(WARN) if
+                    msg.startswith('warning: check:')]
         self.assertEqual(len(warnings), 0)
 
     def test_check_metadata_deprecated(self):