Merged revisions 72681 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72681 | tarek.ziade | 2009-05-16 18:37:06 +0200 (Sat, 16 May 2009) | 1 line

  #6041: sdist and register now use the check command. No more duplicate code for metadata checking
........
diff --git a/Lib/distutils/tests/support.py b/Lib/distutils/tests/support.py
index cdcbc37..1255413 100644
--- a/Lib/distutils/tests/support.py
+++ b/Lib/distutils/tests/support.py
@@ -12,11 +12,31 @@
     def setUp(self):
         super().setUp()
         self.threshold = log.set_threshold(log.FATAL)
+        # catching warnings
+        # when log will be replaced by logging
+        # we won't need such monkey-patch anymore
+        self._old_log = log.Log._log
+        log.Log._log = self._log
+        self.logs = []
 
     def tearDown(self):
         log.set_threshold(self.threshold)
+        log.Log._log = self._old_log
         super().tearDown()
 
+    def _log(self, level, msg, args):
+        self.logs.append((level, msg, args))
+
+    def get_logs(self, *levels):
+        def _format(msg, args):
+            if len(args) == 0:
+                return msg
+            return msg % args
+        return [_format(msg, args) for level, msg, args
+                in self.logs if level in levels]
+
+    def clear_logs(self):
+        self.logs = []
 
 class TempdirManager(object):
     """Mix-in class that handles temporary directories for test cases.