[Python-checkins] test_capi.test__testcapi() becomes more verbose (#4197)

Victor Stinner webhook-mailer at python.org
Tue Oct 31 11:41:02 EDT 2017


https://github.com/python/cpython/commit/e1a470bd6ae87f9501b8830caa64e7a8df0a2302
commit: e1a470bd6ae87f9501b8830caa64e7a8df0a2302
branch: master
author: Victor Stinner <victor.stinner at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-10-31T08:40:59-07:00
summary:

test_capi.test__testcapi() becomes more verbose (#4197)

Write the name of each subtest on a new line to help debugging when
a test does crash Python.

files:
M Lib/test/test_capi.py

diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index 921735ef5d0..bb5b2a3b9f0 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -751,11 +751,16 @@ def callback():
 
 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):



More information about the Python-checkins mailing list