Skip to content

Commit d19b93a

Browse files
[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 6713576) Co-authored-by: stratakis <cstratak@redhat.com>
1 parent 2a3189c commit d19b93a

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)