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
........
This commit is contained in:
Tarek Ziadé 2009-05-16 16:52:13 +00:00
parent afdfbc72fb
commit 5af55c6360
6 changed files with 182 additions and 72 deletions

View file

@ -12,11 +12,31 @@ class LoggingSilencer(object):
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.