summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_warnings.py
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-04-16 15:43:39 (GMT)
committerThomas Wouters <thomas@python.org>2006-04-16 15:43:39 (GMT)
commit767833dc228c9475cd52b99ee8e03793d31d7a81 (patch)
treec1f5684f856e23282b4edab3dbe31bccc40d4e61 /Lib/test/test_warnings.py
parent993633c6f2531e31e907c33cf31ad384d57a86e1 (diff)
downloadcpython-767833dc228c9475cd52b99ee8e03793d31d7a81.zip
cpython-767833dc228c9475cd52b99ee8e03793d31d7a81.tar.gz
cpython-767833dc228c9475cd52b99ee8e03793d31d7a81.tar.bz2
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'.)
Diffstat (limited to 'Lib/test/test_warnings.py')
-rw-r--r--Lib/test/test_warnings.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index 5a3f521..5d051a5 100644
--- a/Lib/test/test_warnings.py
+++ b/Lib/test/test_warnings.py
@@ -82,11 +82,11 @@ class TestModule(unittest.TestCase):
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)