[Python-checkins] r45454 - python/trunk/Lib/test/test_warnings.py

thomas.wouters python-checkins at python.org
Sun Apr 16 17:43:39 CEST 2006


Author: thomas.wouters
Date: Sun Apr 16 17:43:39 2006
New Revision: 45454

Modified:
   python/trunk/Lib/test/test_warnings.py
Log:

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'.)



Modified: python/trunk/Lib/test/test_warnings.py
==============================================================================
--- python/trunk/Lib/test/test_warnings.py	(original)
+++ python/trunk/Lib/test/test_warnings.py	Sun Apr 16 17:43:39 2006
@@ -82,11 +82,11 @@
         self.assertEqual(msg.category, 'UserWarning')
 
 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)
 
-# Obscure hack so that this test passes after reloads (regrtest -R).
-if '__warningregistry__' in globals():
-    del globals()['__warningregistry__']
-
 if __name__ == "__main__":
     test_main(verbose=True)


More information about the Python-checkins mailing list