diff options
author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-04-09 11:59:57 +0100 |
---|---|---|
committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-06-15 16:43:48 +0100 |
commit | 8cb134491569b8800e7f4e20763428258a5f65a8 (patch) | |
tree | 37231779fc9b7a23dd5d1a07ffeaa65d50eb949f /setuptools/tests/test_editable_install.py | |
parent | f9975007b444ad6e6079d2c147e9ed786e4d0361 (diff) | |
download | python-setuptools-git-8cb134491569b8800e7f4e20763428258a5f65a8.tar.gz |
Add namespace test
Diffstat (limited to 'setuptools/tests/test_editable_install.py')
-rw-r--r-- | setuptools/tests/test_editable_install.py | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/setuptools/tests/test_editable_install.py b/setuptools/tests/test_editable_install.py index 0d4980d3..a6693813 100644 --- a/setuptools/tests/test_editable_install.py +++ b/setuptools/tests/test_editable_install.py @@ -1,23 +1,11 @@ import subprocess from textwrap import dedent -import pytest import jaraco.envs import jaraco.path -import path - - -@pytest.fixture -def venv(tmp_path, setuptools_wheel): - env = jaraco.envs.VirtualEnv() - vars(env).update( - root=path.Path(tmp_path), # workaround for error on windows - name=".venv", - create_opts=["--no-setuptools"], - req=str(setuptools_wheel), - ) - return env.create() +import pytest +from . import namespaces EXAMPLE = { 'pyproject.toml': dedent("""\ @@ -111,3 +99,23 @@ def test_editable_with_pyproject(tmp_path, venv, files): (project / "src/mypkg/data.txt").write_text("foobar") (project / "src/mypkg/mod.py").write_text("x = 42") assert subprocess.check_output(cmd).strip() == b"3.14159.post0 foobar 42" + + +class TestLegacyNamespaces: + """Ported from test_develop""" + + def test_namespace_package_importable(self, venv, tmp_path): + """ + Installing two packages sharing the same namespace, one installed + naturally using pip or `--single-version-externally-managed` + and the other installed in editable mode should leave the namespace + intact and both packages reachable by import. + """ + pkg_A = namespaces.build_namespace_package(tmp_path, 'myns.pkgA') + pkg_B = namespaces.build_namespace_package(tmp_path, 'myns.pkgB') + # use pip to install to the target directory + venv.run(["python", "-m", "pip", "install", str(pkg_A)]) + venv.run(["python", "-m", "pip", "install", "-e", str(pkg_B)]) + venv.run(["python", "-c", "import myns.pkgA; import myns.pkgB"]) + # additionally ensure that pkg_resources import works + venv.run(["python", "-c", "import pkg_resources"]) |