Skip to content

gh-98894: Skip dtrace tests when building without dtrace#152239

Open
stratakis wants to merge 1 commit into
python:mainfrom
stratakis:gate_dtrace
Open

gh-98894: Skip dtrace tests when building without dtrace#152239
stratakis wants to merge 1 commit into
python:mainfrom
stratakis:gate_dtrace

Conversation

@stratakis

@stratakis stratakis commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Skip functional test_dtrace cases when CPython was not configured with --with-dtrace.

Skip functional test_dtrace cases when CPython was not configured with
--with-dtrace.
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Jun 26, 2026
@stratakis

Copy link
Copy Markdown
Contributor Author

cc @vstinner

@vstinner

Copy link
Copy Markdown
Member

On a Python built without --with-dtrace, test_dtrace runs exactly one function:

test_filter_probe_rows_ignores_warnings (test.test_dtrace.BPFTraceOutputTests.test_filter_probe_rows_ignores_warnings) ... ok

Hum, I'm not sure that it's worth it to run this single test on a Python built without --with-dtrace.

Instead, I suggest running the check at the module top-level and remove the check from CheckDtraceProbes.setUpClass().

Something like:

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."
    )

So the whole test is skipped:

0:00:00 load avg: 0.72 mem: 29.9 MiB [1/1] test_dtrace
test_dtrace skipped -- CPython must be configured with the --with-dtrace option.
0:00:00 load avg: 0.72 mem: 31.0 MiB [1/1] test_dtrace skipped

@vstinner vstinner added skip news needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants