Reenable coverate instrumentation of test files #11819
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this change https://github.com/DataDog/dd-trace-py/pull/11379/files#diff-3985b6c4c52757d7d726c3002c85935f582641d687acd0f6ab50f93e1294205dR330 in #11379 we had made a number of tests in
tests/coverage/
failing by design, since now the coverage code was non-instrumenting code if it is vendored (aka non-user code). Tests were regularly failing inmain
.Problem is that code from
dd-trace-py/tests
is considered vendored by the algorithm, asdd-trace-py
is installed locally (thinkpip install -e ./
) by the hatchdd_coverage.py3.*
environments, used to run tests: https://gitlab.ddbuild.io/DataDog/apm-reliability/dd-trace-py/-/jobs/747303728#L56.This commit introduces an hack: if the code is invoked as part of a
pytest
run AND comes from thetests
folder, then can be instrumented by the coverage module.While not proud of it, it is the best trade off I could think about without foundational changes to how we run tests in pytest.
Checklist
Reviewer Checklist