Skip to content

Commit

Permalink
Test nested legacy namespaces for editable installs
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Sep 5, 2023
1 parent 39245fc commit 9785782
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions setuptools/tests/test_editable_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ def test_nspkg_file_is_unique(self, tmp_path, monkeypatch):
files = list(installation_dir.glob("*-nspkg.pth"))
assert len(files) == len(examples)

def test_namespace_package_importable(self, venv, tmp_path, editable_opts):
@pytest.mark.parametrize("ns", ("myns.n",))
def test_namespace_package_importable(self, venv, tmp_path, ns, editable_opts):
"""
Installing two packages sharing the same namespace, one installed
naturally using pip or `--single-version-externally-managed`
Expand All @@ -274,16 +275,16 @@ def test_namespace_package_importable(self, venv, tmp_path, editable_opts):
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
"""
pkg_A = namespaces.build_namespace_package(tmp_path, 'myns.pkgA')
pkg_B = namespaces.build_namespace_package(tmp_path, 'myns.pkgB')
pkg_A = namespaces.build_namespace_package(tmp_path, f"{ns}.pkgA")
pkg_B = namespaces.build_namespace_package(tmp_path, f"{ns}.pkgB")
(pkg_A / "pyproject.toml").write_text(build_system, encoding="utf-8")
(pkg_B / "pyproject.toml").write_text(build_system, encoding="utf-8")
# use pip to install to the target directory
opts = editable_opts[:]
opts.append("--no-build-isolation") # force current version of setuptools
venv.run(["python", "-m", "pip", "install", str(pkg_A), *opts])
venv.run(["python", "-m", "pip", "install", "-e", str(pkg_B), *opts])
venv.run(["python", "-c", "import myns.pkgA; import myns.pkgB"])
venv.run(["python", "-c", f"import {ns}.pkgA; import {ns}.pkgB"])
# additionally ensure that pkg_resources import works
venv.run(["python", "-c", "import pkg_resources"])

Expand Down

0 comments on commit 9785782

Please sign in to comment.