]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-98894: Skip test_dtrace when building without dtrace (GH-152239) (#152302)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 26 Jun 2026 21:16:42 +0000 (23:16 +0200)
committerGitHub <noreply@github.com>
Fri, 26 Jun 2026 21:16:42 +0000 (21:16 +0000)
gh-98894: Skip test_dtrace when building without dtrace (GH-152239)
(cherry picked from commit 671357691f84820d4a4799012e937ab9dcbfdaca)

Co-authored-by: stratakis <cstratak@redhat.com>
Lib/test/test_dtrace.py

index ba2fa99707cd469f6e45cb75ebdabe806258c67c..d2ff10c57a0982c563abebcc890a17b4365d9906 100644 (file)
@@ -13,6 +13,10 @@ from test.support import findfile, MS_WINDOWS
 
 if not support.has_subprocess_support:
     raise unittest.SkipTest("test module requires subprocess")
+if not sysconfig.get_config_var('WITH_DTRACE'):
+    raise unittest.SkipTest(
+        "CPython must be configured with the --with-dtrace option."
+    )
 
 
 def abspath(filename):
@@ -178,12 +182,9 @@ class SystemTapOptimizedTests(TraceTests, unittest.TestCase):
 class CheckDtraceProbes(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
-        if sysconfig.get_config_var('WITH_DTRACE'):
-            readelf_major_version, readelf_minor_version = cls.get_readelf_version()
-            if support.verbose:
-                print(f"readelf version: {readelf_major_version}.{readelf_minor_version}")
-        else:
-            raise unittest.SkipTest("CPython must be configured with the --with-dtrace option.")
+        readelf_major_version, readelf_minor_version = cls.get_readelf_version()
+        if support.verbose:
+            print(f"readelf version: {readelf_major_version}.{readelf_minor_version}")
 
 
     @staticmethod