[Python-checkins] gh-104629: Don't skip test_clinic if _testclinic is missing (#104630)

erlend-aasland webhook-mailer at python.org
Thu May 18 18:56:41 EDT 2023


https://github.com/python/cpython/commit/86ee49f469b84e4b746526a00d8191d0e374a268
commit: 86ee49f469b84e4b746526a00d8191d0e374a268
branch: main
author: Erlend E. Aasland <erlend.aasland at protonmail.com>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2023-05-19T00:56:34+02:00
summary:

gh-104629: Don't skip test_clinic if _testclinic is missing (#104630)

Just skip the tests that depend on the _testclinic extension module;
we can still run the Python tests.

files:
M Lib/test/test_clinic.py

diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py
index 28d9f6509264..f72cb0442f35 100644
--- a/Lib/test/test_clinic.py
+++ b/Lib/test/test_clinic.py
@@ -868,9 +868,12 @@ def test_external(self):
         self.assertEqual(new_mtime_ns, old_mtime_ns)
 
 
-ac_tester = import_helper.import_module('_testclinic')
-
+try:
+    import _testclinic as ac_tester
+except ImportError:
+    ac_tester = None
 
+ at unittest.skipIf(ac_tester is None, "_testclinic is missing")
 class ClinicFunctionalTest(unittest.TestCase):
     locals().update((name, getattr(ac_tester, name))
                     for name in dir(ac_tester) if name.startswith('test_'))



More information about the Python-checkins mailing list