Skip to content

Commit 5a941c1

Browse files
chore: fix test_module_watchdog_pkg_resources_support [backport 3.8] (#13531)
Backport 3eaf6a8 from #13513 to 3.8. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - 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) Co-authored-by: Taegyun Kim <[email protected]>
1 parent 588ca68 commit 5a941c1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/internal/test_module.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def test_module_watchdog_namespace_import_no_warnings():
434434
import namespace_test.ns_module # noqa:F401
435435

436436

437-
@pytest.mark.subprocess(ddtrace_run=True, env=dict(NSPATH=str(Path(__file__).parent)))
437+
@pytest.mark.subprocess(ddtrace_run=True, env=dict(NSPATH=str(Path(__file__).parent)), err=None)
438438
def test_module_watchdog_pkg_resources_support():
439439
# Test that we can access resource files with pkg_resources without raising
440440
# an exception.
@@ -443,9 +443,12 @@ def test_module_watchdog_pkg_resources_support():
443443

444444
sys.path.insert(0, os.getenv("NSPATH"))
445445

446-
import pkg_resources as p
446+
try:
447+
import pkg_resources as p
447448

448-
p.resource_listdir("namespace_test.ns_module", ".")
449+
p.resource_listdir("namespace_test.ns_module", ".")
450+
except Exception as e:
451+
pytest.fail("Using pkg_resources raised exception", e)
449452

450453

451454
@pytest.mark.subprocess(

0 commit comments

Comments
 (0)