From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 26 Jun 2026 20:59:17 +0000 (+0200) Subject: [3.15] gh-98894: Skip test_dtrace when building without dtrace (GH-152239) (#152300) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d19b93a6fcacd2914ab60f181b27614f07189a08;p=thirdparty%2FPython%2Fcpython.git [3.15] gh-98894: Skip test_dtrace when building without dtrace (GH-152239) (#152300) gh-98894: Skip test_dtrace when building without dtrace (GH-152239) (cherry picked from commit 671357691f84820d4a4799012e937ab9dcbfdaca) Co-authored-by: stratakis --- diff --git a/Lib/test/test_dtrace.py b/Lib/test/test_dtrace.py index 3de87fc704d4..2cfd94239aee 100644 --- a/Lib/test/test_dtrace.py +++ b/Lib/test/test_dtrace.py @@ -14,6 +14,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): @@ -397,12 +401,9 @@ class BPFTraceOptimizedTests(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