]> granicus.if.org Git - python/commitdiff
test_capi.test__testcapi() becomes more verbose (#4197)
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 31 Oct 2017 15:40:59 +0000 (08:40 -0700)
committerGitHub <noreply@github.com>
Tue, 31 Oct 2017 15:40:59 +0000 (08:40 -0700)
Write the name of each subtest on a new line to help debugging when
a test does crash Python.

Lib/test/test_capi.py

index 921735ef5d016b5f48c85753d71079316b205ee7..bb5b2a3b9f0d73402f8320859fef0ae7591a56f2 100644 (file)
@@ -751,11 +751,16 @@ class TestThreadState(unittest.TestCase):
 
 class Test_testcapi(unittest.TestCase):
     def test__testcapi(self):
+        if support.verbose:
+            print()
         for name in dir(_testcapi):
-            if name.startswith('test_'):
-                with self.subTest("internal", name=name):
-                    test = getattr(_testcapi, name)
-                    test()
+            if not name.startswith('test_'):
+                continue
+            with self.subTest("internal", name=name):
+                if support.verbose:
+                    print(f"  {name}", flush=True)
+                test = getattr(_testcapi, name)
+                test()
 
 
 class PyMemDebugTests(unittest.TestCase):