diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-13 21:06:00 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-13 21:06:00 -0500 |
commit | bffd26f485964e1cfb881ccf85179b2947d5e734 (patch) | |
tree | 16f875c6d98b146ee4c71c1c92eb84e57b8c2f23 /setuptools/tests/test_namespaces.py | |
parent | d9c9284e19ce475c2366b279dd4db82a2751a571 (diff) | |
download | python-setuptools-git-bffd26f485964e1cfb881ccf85179b2947d5e734.tar.gz |
Add test capturing expectation when a package is both installed and in the current working directory. Ref #885.
Diffstat (limited to 'setuptools/tests/test_namespaces.py')
-rw-r--r-- | setuptools/tests/test_namespaces.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/setuptools/tests/test_namespaces.py b/setuptools/tests/test_namespaces.py index 2aefb487..5199129e 100644 --- a/setuptools/tests/test_namespaces.py +++ b/setuptools/tests/test_namespaces.py @@ -73,3 +73,30 @@ class TestNamespaces: '-c', 'import pkg_resources', ] subprocess.check_call(try_import, env=env) + + @pytest.mark.skipif(bool(os.environ.get("APPVEYOR")), + reason="https://github.com/pypa/setuptools/issues/851") + def test_namespace_package_installed_and_cwd(self, tmpdir): + """ + Installing a namespace packages but also having it in the current + working directory, only one version should take precedence. + """ + pkg_A = namespaces.build_namespace_package(tmpdir, 'myns.pkgA') + target = tmpdir / 'packages' + # use pip to install to the target directory + install_cmd = [ + 'pip', + 'install', + str(pkg_A), + '-t', str(target), + ] + subprocess.check_call(install_cmd) + namespaces.make_site_dir(target) + + # ensure that package imports and pkg_resources imports + pkg_resources_imp = [ + sys.executable, + '-c', 'import pkg_resources; import myns.pkgA', + ] + env = dict(PYTHONPATH=str(target)) + subprocess.check_call(pkg_resources_imp, env=env, cwd=str(pkg_A)) |