[Python-checkins] cpython: Move test_imp over to unittest.main()

brett.cannon python-checkins at python.org
Fri May 3 16:57:16 CEST 2013


http://hg.python.org/cpython/rev/78c60e2eb3f3
changeset:   83597:78c60e2eb3f3
user:        Brett Cannon <brett at python.org>
date:        Fri May 03 10:56:19 2013 -0400
summary:
  Move test_imp over to unittest.main()

files:
  Lib/test/test_imp.py |  22 ++++++----------------
  1 files changed, 6 insertions(+), 16 deletions(-)


diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -1,3 +1,7 @@
+try:
+    import _thread
+except ImportError:
+    _thread = None
 import imp
 import importlib
 import os
@@ -17,6 +21,7 @@
                            'imp.load_dynamic() required')(meth)
 
 
+ at unittest.skipIf(_thread is None, '_thread module is required')
 class LockTests(unittest.TestCase):
 
     """Very basic test of import lock functions."""
@@ -446,20 +451,5 @@
             os.rmdir(name)
 
 
-def test_main():
-    tests = [
-        ImportTests,
-        PEP3147Tests,
-        ReloadTests,
-        NullImporterTests,
-        ]
-    try:
-        import _thread
-    except ImportError:
-        pass
-    else:
-        tests.append(LockTests)
-    support.run_unittest(*tests)
-
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
\ No newline at end of file

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list