]> granicus.if.org Git - python/commitdiff
Issue #19440: Clean up test_capi
authorZachary Ware <zachary.ware@gmail.com>
Tue, 12 Nov 2013 04:47:04 +0000 (22:47 -0600)
committerZachary Ware <zachary.ware@gmail.com>
Tue, 12 Nov 2013 04:47:04 +0000 (22:47 -0600)
Lib/test/test_capi.py
Misc/NEWS

index f1ea5a9fdeb7afbd1ad5d8db31c4c18f158631bc..9013a7b18800b41932433b842daed288008f20ba 100644 (file)
@@ -1,7 +1,6 @@
 # Run the _testcapi module tests (tests for the Python/C API):  by defn,
 # these are all functions _testcapi exports whose name begins with 'test_'.
 
-from __future__ import with_statement
 import os
 import pickle
 import random
@@ -351,17 +350,12 @@ class TestThreadState(unittest.TestCase):
         t.start()
         t.join()
 
-
-def test_main():
-    support.run_unittest(CAPITest, TestPendingCalls, Test6012,
-                         EmbeddingTest, SkipitemTest, TestThreadState)
-
-    for name in dir(_testcapi):
-        if name.startswith('test_'):
-            test = getattr(_testcapi, name)
-            if support.verbose:
-                print("internal", name)
-            test()
+class Test_testcapi(unittest.TestCase):
+    def test__testcapi(self):
+        for name in dir(_testcapi):
+            if name.startswith('test_'):
+                test = getattr(_testcapi, name)
+                test()
 
 if __name__ == "__main__":
-    test_main()
+    unittest.main()
index 9abddbb751f28682c09c0df63ec17e056215efde..b09f4d116e9154db533d8b2eb8a6648a4f343e73 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -42,6 +42,10 @@ Library
 Tests
 -----
 
+- Issue #19440: Clean up test_capi by removing an unnecessary __future__
+  import, converting from test_main to unittest.main, and running the
+  _testcapi module tests within a unittest TestCase.
+
 - Issue #18702: All skipped tests now reported as skipped.
 
 - Issue #19085: Added basic tests for all tkinter widget options.