Kaydet (Commit) 767833dc authored tarafından Thomas Wouters's avatar Thomas Wouters

Make test_warnings play nice with regrtest -R:: now that regrtest doesn't

always reload the module (specifically, it doesn't reload if the module has
a 'test_main'.)
üst 993633c6
...@@ -82,11 +82,11 @@ class TestModule(unittest.TestCase): ...@@ -82,11 +82,11 @@ class TestModule(unittest.TestCase):
self.assertEqual(msg.category, 'UserWarning') self.assertEqual(msg.category, 'UserWarning')
def test_main(verbose=None): def test_main(verbose=None):
# Obscure hack so that this test passes after reloads or repeated calls
# to test_main (regrtest -R).
if '__warningregistry__' in globals():
del globals()['__warningregistry__']
test_support.run_unittest(TestModule) test_support.run_unittest(TestModule)
# Obscure hack so that this test passes after reloads (regrtest -R).
if '__warningregistry__' in globals():
del globals()['__warningregistry__']
if __name__ == "__main__": if __name__ == "__main__":
test_main(verbose=True) test_main(verbose=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment