Filter new pkg_resources deprecations (#10938)
Fixes https://github.com/pytest-dev/pytest/issues/10815
This commit is contained in:
parent
158f41fdf8
commit
e03f82c359
|
@ -695,11 +695,15 @@ class TestInvocationVariants:
|
||||||
monkeypatch.chdir("world")
|
monkeypatch.chdir("world")
|
||||||
|
|
||||||
# pgk_resources.declare_namespace has been deprecated in favor of implicit namespace packages.
|
# pgk_resources.declare_namespace has been deprecated in favor of implicit namespace packages.
|
||||||
|
# pgk_resources has been deprecated entirely.
|
||||||
# While we could change the test to use implicit namespace packages, seems better
|
# While we could change the test to use implicit namespace packages, seems better
|
||||||
# to still ensure the old declaration via declare_namespace still works.
|
# to still ensure the old declaration via declare_namespace still works.
|
||||||
ignore_w = r"-Wignore:Deprecated call to `pkg_resources.declare_namespace"
|
ignore_w = (
|
||||||
|
r"-Wignore:Deprecated call to `pkg_resources.declare_namespace",
|
||||||
|
r"-Wignore:pkg_resources is deprecated",
|
||||||
|
)
|
||||||
result = pytester.runpytest(
|
result = pytester.runpytest(
|
||||||
"--pyargs", "-v", "ns_pkg.hello", "ns_pkg/world", ignore_w
|
"--pyargs", "-v", "ns_pkg.hello", "ns_pkg/world", *ignore_w
|
||||||
)
|
)
|
||||||
assert result.ret == 0
|
assert result.ret == 0
|
||||||
result.stdout.fnmatch_lines(
|
result.stdout.fnmatch_lines(
|
||||||
|
|
|
@ -425,9 +425,7 @@ def test_context_classmethod() -> None:
|
||||||
assert A.x == 1
|
assert A.x == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.filterwarnings(
|
@pytest.mark.filterwarnings(r"ignore:.*\bpkg_resources\b:DeprecationWarning")
|
||||||
"ignore:Deprecated call to `pkg_resources.declare_namespace"
|
|
||||||
)
|
|
||||||
def test_syspath_prepend_with_namespace_packages(
|
def test_syspath_prepend_with_namespace_packages(
|
||||||
pytester: Pytester, monkeypatch: MonkeyPatch
|
pytester: Pytester, monkeypatch: MonkeyPatch
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
Loading…
Reference in New Issue