]> granicus.if.org Git - python/commitdiff
Move test_imp over to unittest.main()
authorBrett Cannon <brett@python.org>
Fri, 3 May 2013 14:56:19 +0000 (10:56 -0400)
committerBrett Cannon <brett@python.org>
Fri, 3 May 2013 14:56:19 +0000 (10:56 -0400)
Lib/test/test_imp.py

index f9b87bb0351726211d69c5417c6a0dc46e5b7346..1cd7c8a02e5ed2d18f8bcd7f3ad1319545909f63 100644 (file)
@@ -1,3 +1,7 @@
+try:
+    import _thread
+except ImportError:
+    _thread = None
 import imp
 import importlib
 import os
@@ -17,6 +21,7 @@ def requires_load_dynamic(meth):
                            'imp.load_dynamic() required')(meth)
 
 
+@unittest.skipIf(_thread is None, '_thread module is required')
 class LockTests(unittest.TestCase):
 
     """Very basic test of import lock functions."""
@@ -446,20 +451,5 @@ class NullImporterTests(unittest.TestCase):
             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