Skip to content

Commit 9693556

Browse files
[7.2.x] Fix test_cmdline_python_namespace_package (#10789)
Co-authored-by: Bruno Oliveira <[email protected]>
1 parent e8e7d44 commit 9693556

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

testing/acceptance_test.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,14 @@ def test_cmdline_python_namespace_package(
694694

695695
# mixed module and filenames:
696696
monkeypatch.chdir("world")
697-
result = pytester.runpytest("--pyargs", "-v", "ns_pkg.hello", "ns_pkg/world")
697+
698+
# pgk_resources.declare_namespace has been deprecated in favor of implicit namespace packages.
699+
# While we could change the test to use implicit namespace packages, seems better
700+
# to still ensure the old declaration via declare_namespace still works.
701+
ignore_w = r"-Wignore:Deprecated call to `pkg_resources.declare_namespace"
702+
result = pytester.runpytest(
703+
"--pyargs", "-v", "ns_pkg.hello", "ns_pkg/world", ignore_w
704+
)
698705
assert result.ret == 0
699706
result.stdout.fnmatch_lines(
700707
[

testing/test_monkeypatch.py

+3
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@ class A:
425425
assert A.x == 1
426426

427427

428+
@pytest.mark.filterwarnings(
429+
"ignore:Deprecated call to `pkg_resources.declare_namespace"
430+
)
428431
def test_syspath_prepend_with_namespace_packages(
429432
pytester: Pytester, monkeypatch: MonkeyPatch
430433
) -> None:

0 commit comments

Comments
 (0)