Skip to content

fix: force trace core when dynamic contexts are requested - #757

Draft
aryansk wants to merge 1 commit into
pytest-dev:masterfrom
aryansk:fix-dynamic-context-coveragepy-755
Draft

fix: force trace core when dynamic contexts are requested#757
aryansk wants to merge 1 commit into
pytest-dev:masterfrom
aryansk:fix-dynamic-context-coveragepy-755

Conversation

@aryansk

@aryansk aryansk commented Aug 18, 2026

Copy link
Copy Markdown

Summary

Fixes #755

When --cov-context=test is used, force the trace core instead of sysmon (the default on Python 3.14+) because sysmon does not support dynamic contexts and coveragepy >= 7.15.3 emits a warning:

Dynamic contexts aren't supported with core=sysmon; context data may be incomplete (no-sysmon-context)

Fix

Added a _coverage_core property to CovController that returns 'trace' when cov_context == 'test', and None otherwise (preserving the default core selection). This is applied to all three Coverage() constructor call sites (Central, DistMaster, DistWorker).

Testing

The existing test suite covers the dynamic context functionality. The fix is backward-compatible: when --cov-context is not used, no core override is applied.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff noreply@codebuff.com

When --cov-context=test is used, force the trace core instead of
sysmon (the default on Python 3.14+) because sysmon does not support
dynamic contexts and coveragepy >= 7.15.3 emits a warning:

    Dynamic contexts aren't supported with core=sysmon; context data
    may be incomplete (no-sysmon-context)

The _coverage_core property returns 'trace' when cov_context == 'test',
and None otherwise (preserving the default core selection). This is
applied to all three Coverage() constructor call sites (Central,
DistMaster, DistWorker).

Fixes pytest-dev#755

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@webknjaz

Copy link
Copy Markdown
Member

Not sure how this is helping but https://agentscan.tools/user/aryansk does not fill me with hope...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Only set dynamic context on coveragepy cores supporting it, perhaps?

2 participants