Skip to content

Commit fc6345d

Browse files
fix(itr): add skipped test check for coverage [backport 2.2] (#7609)
Backport 699adfa from #7604 to 2.2. ## What does this PR do? This PR ensures that code coverage for ITR won't be enabled if it is a skipped `unittest` test. ## Checklist - [X] Change(s) are motivated and described in the PR description. - [X] Testing strategy is described if automated tests are not included in the PR. - [X] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [X] Change is maintainable (easy to change, telemetry, documentation). - [X] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [X] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [X] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) - [x] If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from `@DataDog/security-design-and-guidance`. - [x] This PR doesn't touch any of that. Co-authored-by: Eric Navarro <[email protected]>
1 parent fc275d0 commit fc6345d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ddtrace/contrib/unittest/patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ def handle_test_wrapper(func, instance, args: tuple, kwargs: dict):
601601
)
602602
result.stopTest(test=instance)
603603
else:
604-
if _CIVisibility._instance._collect_coverage_enabled:
604+
if _is_test_coverage_enabled(instance):
605605
coverage = _start_coverage(root_directory)
606606
instance._coverage = coverage
607607
result = func(*args, **kwargs)

0 commit comments

Comments
 (0)