Skip to content

Commit e7b7d58

Browse files
[3.14] gh-98894: Skip test_dtrace when building without dtrace (GH-152239) (#152301)
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 b1679d5 commit e7b7d58

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
@@ -13,6 +13,10 @@
1313

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

1721

1822
def abspath(filename):
@@ -178,12 +182,9 @@ class SystemTapOptimizedTests(TraceTests, unittest.TestCase):
178182
class CheckDtraceProbes(unittest.TestCase):
179183
@classmethod
180184
def setUpClass(cls):
181-
if sysconfig.get_config_var('WITH_DTRACE'):
182-
readelf_major_version, readelf_minor_version = cls.get_readelf_version()
183-
if support.verbose:
184-
print(f"readelf version: {readelf_major_version}.{readelf_minor_version}")
185-
else:
186-
raise unittest.SkipTest("CPython must be configured with the --with-dtrace option.")
185+
readelf_major_version, readelf_minor_version = cls.get_readelf_version()
186+
if support.verbose:
187+
print(f"readelf version: {readelf_major_version}.{readelf_minor_version}")
187188

188189

189190
@staticmethod

0 commit comments

Comments
 (0)