diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-05-16 16:52:13 +0000 |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-05-16 16:52:13 +0000 |
commit | 5af55c63607fb6bebfc95c57e6eda5db0c669b46 (patch) | |
tree | 13c4c08c3c60fbe5b79c1432145c1f0dc676070a /Lib/distutils/tests/support.py | |
parent | afdfbc72fb58dd01200573728e603b3da246c6e6 (diff) | |
download | cpython-git-5af55c63607fb6bebfc95c57e6eda5db0c669b46.tar.gz |
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
........
Diffstat (limited to 'Lib/distutils/tests/support.py')
-rw-r--r-- | Lib/distutils/tests/support.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/distutils/tests/support.py b/Lib/distutils/tests/support.py index cdcbc37862..1255413989 100644 --- a/Lib/distutils/tests/support.py +++ b/Lib/distutils/tests/support.py @@ -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. |