diff options
Diffstat (limited to 'Lib/test/test_warnings.py')
-rw-r--r-- | Lib/test/test_warnings.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py index dda704e..7bd7191 100644 --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -27,11 +27,15 @@ def warnings_state(module): except NameError: pass original_warnings = warning_tests.warnings + original_filters = module.filters try: + module.filters = original_filters[:] + module.simplefilter("once") warning_tests.warnings = module yield finally: warning_tests.warnings = original_warnings + module.filters = original_filters class BaseTest(unittest.TestCase): @@ -194,6 +198,7 @@ class WarnTests(unittest.TestCase): def test_message(self): with original_warnings.catch_warnings(record=True, module=self.module) as w: + self.module.simplefilter("once") for i in range(4): text = 'multi %d' %i # Different text on each call. self.module.warn(text) @@ -206,6 +211,7 @@ class WarnTests(unittest.TestCase): for ob in (Warning, None, 42): with original_warnings.catch_warnings(record=True, module=self.module) as w: + self.module.simplefilter("once") self.module.warn(ob) # Don't directly compare objects since # ``Warning() != Warning()``. |