11import subprocess
22import sys
33
4- import pytest
5-
64from setuptools ._path import paths_on_pythonpath
75
86from . import namespaces
97
108
119class TestNamespaces :
12- @pytest .mark .xfail (reason = "pkg_resources has been removed" )
1310 def test_mixed_site_and_non_site (self , tmpdir ):
1411 """
1512 Installing two packages sharing the same namespace, one installed
@@ -52,36 +49,6 @@ def test_mixed_site_and_non_site(self, tmpdir):
5249 with paths_on_pythonpath (map (str , targets )):
5350 subprocess .check_call (try_import )
5451
55- @pytest .mark .xfail (reason = "pkg_resources has been removed" )
56- def test_pkg_resources_import (self , tmpdir ):
57- """
58- Ensure that a namespace package doesn't break on import
59- of pkg_resources.
60- """
61- pkg = namespaces .build_namespace_package (tmpdir , 'myns.pkgA' )
62- target = tmpdir / 'packages'
63- target .mkdir ()
64- install_cmd = [
65- sys .executable ,
66- '-m' ,
67- 'pip' ,
68- 'install' ,
69- '-t' ,
70- str (target ),
71- str (pkg ),
72- ]
73- with paths_on_pythonpath ([str (target )]):
74- subprocess .check_call (install_cmd )
75- namespaces .make_site_dir (target )
76- try_import = [
77- sys .executable ,
78- '-c' ,
79- 'import pkg_resources' ,
80- ]
81- with paths_on_pythonpath ([str (target )]):
82- subprocess .check_call (try_import )
83-
84- @pytest .mark .xfail (reason = "pkg_resources has been removed" )
8552 def test_namespace_package_installed_and_cwd (self , tmpdir ):
8653 """
8754 Installing a namespace packages but also having it in the current
@@ -102,43 +69,11 @@ def test_namespace_package_installed_and_cwd(self, tmpdir):
10269 subprocess .check_call (install_cmd )
10370 namespaces .make_site_dir (target )
10471
105- # ensure that package imports and pkg_resources imports
72+ # ensure that package imports
10673 pkg_resources_imp = [
10774 sys .executable ,
10875 '-c' ,
109- 'import pkg_resources; import myns.pkgA' ,
76+ 'import myns.pkgA' ,
11077 ]
11178 with paths_on_pythonpath ([str (target )]):
11279 subprocess .check_call (pkg_resources_imp , cwd = str (pkg_A ))
113-
114- @pytest .mark .xfail (reason = "pkg_resources has been removed" )
115- def test_packages_in_the_same_namespace_installed_and_cwd (self , tmpdir ):
116- """
117- Installing one namespace package and also have another in the same
118- namespace in the current working directory, both of them must be
119- importable.
120- """
121- pkg_A = namespaces .build_namespace_package (tmpdir , 'myns.pkgA' )
122- pkg_B = namespaces .build_namespace_package (tmpdir , 'myns.pkgB' )
123- target = tmpdir / 'packages'
124- # use pip to install to the target directory
125- install_cmd = [
126- sys .executable ,
127- '-m' ,
128- 'pip.__main__' ,
129- 'install' ,
130- str (pkg_A ),
131- '-t' ,
132- str (target ),
133- ]
134- subprocess .check_call (install_cmd )
135- namespaces .make_site_dir (target )
136-
137- # ensure that all packages import and pkg_resources imports
138- pkg_resources_imp = [
139- sys .executable ,
140- '-c' ,
141- 'import pkg_resources; import myns.pkgA; import myns.pkgB' ,
142- ]
143- with paths_on_pythonpath ([str (target )]):
144- subprocess .check_call (pkg_resources_imp , cwd = str (pkg_B ))
0 commit comments