Skip to content

Commit 4e23d32

Browse files
committed
gh-98894: Skip dtrace tests when building without dtrace
1 parent 55bc312 commit 4e23d32

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

Lib/test/test_dtrace.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
if not support.has_subprocess_support:
1616
raise unittest.SkipTest("test module requires subprocess")
17+
if not sysconfig.get_config_var('WITH_DTRACE'):
18+
raise unittest.SkipTest(
19+
"CPython must be configured with the --with-dtrace option."
20+
)
1721

1822

1923
def abspath(filename):
@@ -397,12 +401,9 @@ class BPFTraceOptimizedTests(TraceTests, unittest.TestCase):
397401
class CheckDtraceProbes(unittest.TestCase):
398402
@classmethod
399403
def setUpClass(cls):
400-
if sysconfig.get_config_var('WITH_DTRACE'):
401-
readelf_major_version, readelf_minor_version = cls.get_readelf_version()
402-
if support.verbose:
403-
print(f"readelf version: {readelf_major_version}.{readelf_minor_version}")
404-
else:
405-
raise unittest.SkipTest("CPython must be configured with the --with-dtrace option.")
404+
readelf_major_version, readelf_minor_version = cls.get_readelf_version()
405+
if support.verbose:
406+
print(f"readelf version: {readelf_major_version}.{readelf_minor_version}")
406407

407408

408409
@staticmethod

0 commit comments

Comments
 (0)