diff options
author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-07-06 23:35:53 +0100 |
---|---|---|
committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2023-02-13 19:09:28 +0000 |
commit | 2177e1f813a6aa05c29a8f36d787171d954465c7 (patch) | |
tree | ca00656cd25bdbf74f308954ca3f61de5870943a /pkg_resources/tests/test_resources.py | |
parent | c8a6a4a1c97f267faef01c0db879ea599dfc0e11 (diff) | |
download | python-setuptools-git-2177e1f813a6aa05c29a8f36d787171d954465c7.tar.gz |
Add DeprecationWarning to `pkg_resources.declare_namespace`
Diffstat (limited to 'pkg_resources/tests/test_resources.py')
-rw-r--r-- | pkg_resources/tests/test_resources.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py index 107dda7b..2138f95e 100644 --- a/pkg_resources/tests/test_resources.py +++ b/pkg_resources/tests/test_resources.py @@ -830,10 +830,12 @@ class TestNamespaces: pkg2.ensure_dir() (pkg1 / '__init__.py').write_text(self.ns_str, encoding='utf-8') (pkg2 / '__init__.py').write_text(self.ns_str, encoding='utf-8') - import pkg1 + with pytest.warns(DeprecationWarning, match="pkg_resources.declare_namespace"): + import pkg1 assert "pkg1" in pkg_resources._namespace_packages # attempt to import pkg2 from site-pkgs2 - import pkg1.pkg2 + with pytest.warns(DeprecationWarning, match="pkg_resources.declare_namespace"): + import pkg1.pkg2 # check the _namespace_packages dict assert "pkg1.pkg2" in pkg_resources._namespace_packages assert pkg_resources._namespace_packages["pkg1"] == ["pkg1.pkg2"] @@ -874,8 +876,9 @@ class TestNamespaces: (subpkg / '__init__.py').write_text( vers_str % number, encoding='utf-8') - import nspkg.subpkg - import nspkg + with pytest.warns(DeprecationWarning, match="pkg_resources.declare_namespace"): + import nspkg.subpkg + import nspkg expected = [ str(site.realpath() / 'nspkg') for site in site_dirs |