Skip to content

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

Merged
vstinner merged 1 commit into
python:mainfrom
stratakis:gate_dtrace
Jun 26, 2026
Merged

vstinner merged 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.

@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 only security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Jun 26, 2026

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I prefer this simpler change!

@vstinner

Copy link
Copy Markdown
Member

Note: try to avoid git push --force, it makes reviews harder to follow.

@vstinner
vstinner enabled auto-merge (squash) June 26, 2026 14:25
@vstinner
vstinner merged commit 6713576 into python:main Jun 26, 2026
52 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @stratakis for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

GH-152300 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Jun 26, 2026
@bedevere-app

bedevere-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

GH-152301 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 26, 2026
@bedevere-app

bedevere-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

GH-152302 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Jun 26, 2026
vstinner pushed a commit that referenced this pull request Jun 26, 2026
…2239) (#152301)

gh-98894: Skip test_dtrace when building without dtrace (GH-152239)
(cherry picked from commit 6713576)

Co-authored-by: stratakis <cstratak@redhat.com>
vstinner pushed a commit that referenced this pull request Jun 26, 2026
…2239) (#152300)

gh-98894: Skip test_dtrace when building without dtrace (GH-152239)
(cherry picked from commit 6713576)

Co-authored-by: stratakis <cstratak@redhat.com>
vstinner pushed a commit that referenced this pull request Jun 26, 2026
…2239) (#152302)

gh-98894: Skip test_dtrace when building without dtrace (GH-152239)
(cherry picked from commit 6713576)

Co-authored-by: stratakis <cstratak@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants