[Python-checkins] r45237 - python/trunk/Lib/test/test_contextlib.py

phillip.eby python-checkins at python.org
Mon Apr 10 20:33:18 CEST 2006


Author: phillip.eby
Date: Mon Apr 10 20:33:17 2006
New Revision: 45237

Modified:
   python/trunk/Lib/test/test_contextlib.py
Log:
test_contextlib wasn't actually being run by regrtest.py.  Or more precisely,
it was being run, but no tests were actually executed!


Modified: python/trunk/Lib/test/test_contextlib.py
==============================================================================
--- python/trunk/Lib/test/test_contextlib.py	(original)
+++ python/trunk/Lib/test/test_contextlib.py	Mon Apr 10 20:33:17 2006
@@ -2,12 +2,14 @@
 
 from __future__ import with_statement
 
+import sys
 import os
 import decimal
 import tempfile
 import unittest
 import threading
 from contextlib import *  # Tests __all__
+from test.test_support import run_suite
 
 class ContextManagerTestCase(unittest.TestCase):
 
@@ -327,5 +329,11 @@
             self.fail("Didn't raise ZeroDivisionError")
 
 
+# This is needed to make the test actually run under regrtest.py!
+def test_main():
+    run_suite(
+        unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__])
+    )
+
 if __name__ == "__main__":
-    unittest.main()
+    test_main()


More information about the Python-checkins mailing list