]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-104629: Don't skip test_clinic if _testclinic is missing (GH-104630) (...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 18 May 2023 23:20:35 +0000 (16:20 -0700)
committerGitHub <noreply@github.com>
Thu, 18 May 2023 23:20:35 +0000 (23:20 +0000)
gh-104629: Don't skip test_clinic if _testclinic is missing (GH-104630)

Just skip the tests that depend on the _testclinic extension module;
we can still run the Python tests.
(cherry picked from commit 86ee49f469b84e4b746526a00d8191d0e374a268)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Lib/test/test_clinic.py

index a84d24a7984475f4ad5c08a31133372fb0780b3f..02a54bf154eeca703be8b2e992f2379991a9bf6c 100644 (file)
@@ -829,9 +829,12 @@ class ClinicExternalTest(TestCase):
         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
 
+@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_'))