summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-03-20 21:19:49 -0400
committerJason R. Coombs <jaraco@jaraco.com>2021-03-20 21:19:49 -0400
commitb4d8e4755eafc786a9848333ca73bff381747745 (patch)
tree2b28c72a4df0dba750963bb3628683132cb50100 /setuptools
parent8230bbf82b07d25bcc65e612e0e936dce269e463 (diff)
downloadpython-setuptools-git-b4d8e4755eafc786a9848333ca73bff381747745.tar.gz
Add test capturing missed expectation. Ref #2612.
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/tests/fixtures.py14
-rw-r--r--setuptools/tests/test_develop.py30
2 files changed, 44 insertions, 0 deletions
diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py
index d74b5f03..a5a172e0 100644
--- a/setuptools/tests/fixtures.py
+++ b/setuptools/tests/fixtures.py
@@ -1,6 +1,7 @@
import contextlib
import sys
import shutil
+import subprocess
import pytest
@@ -58,3 +59,16 @@ def workaround_xdist_376(request):
with contextlib.suppress(ValueError):
sys.path.remove('')
+
+
+@pytest.fixture
+def sample_project(tmp_path):
+ """
+ Clone the 'sampleproject' and return a path to it.
+ """
+ cmd = ['git', 'clone', 'https://github.com/pypa/sampleproject']
+ try:
+ subprocess.check_call(cmd, cwd=str(tmp_path))
+ except Exception:
+ pytest.skip("Unable to clone sampleproject")
+ return tmp_path / 'sampleproject'
diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py
index 2766da2f..e793c36d 100644
--- a/setuptools/tests/test_develop.py
+++ b/setuptools/tests/test_develop.py
@@ -7,6 +7,7 @@ import sys
import io
import subprocess
import platform
+import pathlib
from setuptools.command import test
@@ -199,3 +200,32 @@ class TestNamespaces:
]
with test.test.paths_on_pythonpath([str(target)]):
subprocess.check_call(pkg_resources_imp)
+
+ @pytest.mark.xfail(reason="#2612")
+ def test_editable_prefix(self, tmp_path, sample_project):
+ """
+ Editable install to a prefix should be discoverable.
+ """
+ prefix = tmp_path / 'prefix'
+ prefix.mkdir()
+
+ cmd = [
+ sys.executable,
+ '-m', 'pip',
+ 'install',
+ '-e', str(sample_project),
+ '--prefix', str(prefix),
+ ]
+ subprocess.check_call(cmd)
+
+ # now run 'sample' with the prefix on the PYTHONPATH
+ site_packages = prefix / next(
+ pathlib.Path(path).relative_to(sys.prefix)
+ for path in sys.path
+ if 'site-packages' in path
+ and path.startswith(sys.prefix)
+ )
+ env = dict(PYTHONPATH=site_packages)
+ bin = 'Scripts' if platform.system() == 'Windows' else 'bin'
+ sample = prefix / bin / 'sample'
+ subprocess.check_call([sample], env=env)