summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-01-22 20:45:08 -0500
committerJason R. Coombs <jaraco@jaraco.com>2022-01-22 20:45:08 -0500
commitc4d780731ac1331667a46f8de3a80fbff33db2c7 (patch)
tree1584f8ad9bde06bfe6c10be384de7828f69b16a5
parentaf875d6573c90c5df4a32f948dc65598c58dbf2b (diff)
downloadpython-setuptools-git-c4d780731ac1331667a46f8de3a80fbff33db2c7.tar.gz
Rely on pip_run.launch to install sitecustomize.
-rw-r--r--setup.cfg1
-rw-r--r--setuptools/tests/test_develop.py23
2 files changed, 5 insertions, 19 deletions
diff --git a/setup.cfg b/setup.cfg
index b83d3763..0dc90438 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -65,6 +65,7 @@ testing =
jaraco.path>=3.2.0
build[virtualenv]
filelock>=3.4.0
+ pip_run>=8.8
testing-integration =
pytest
diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py
index 1aeb7ffe..c52072ac 100644
--- a/setuptools/tests/test_develop.py
+++ b/setuptools/tests/test_develop.py
@@ -6,11 +6,11 @@ import sys
import subprocess
import platform
import pathlib
-import textwrap
from setuptools.command import test
import pytest
+import pip_run.launch
from setuptools.command.develop import develop
from setuptools.dist import Distribution
@@ -166,21 +166,6 @@ class TestNamespaces:
with test.test.paths_on_pythonpath([str(target)]):
subprocess.check_call(pkg_resources_imp)
- @staticmethod
- def install_workaround(site_packages):
- site_packages.mkdir(parents=True)
- sc = site_packages / 'sitecustomize.py'
- sc.write_text(
- textwrap.dedent(
- """
- import site
- import pathlib
- here = pathlib.Path(__file__).parent
- site.addsitedir(str(here))
- """
- ).lstrip()
- )
-
@pytest.mark.xfail(
platform.python_implementation() == 'PyPy',
reason="Workaround fails on PyPy (why?)",
@@ -190,7 +175,6 @@ class TestNamespaces:
Editable install to a prefix should be discoverable.
"""
prefix = tmp_path / 'prefix'
- prefix.mkdir()
# figure out where pip will likely install the package
site_packages = prefix / next(
@@ -198,9 +182,10 @@ class TestNamespaces:
for path in sys.path
if 'site-packages' in path and path.startswith(sys.prefix)
)
+ site_packages.mkdir(parents=True)
- # install the workaround
- self.install_workaround(site_packages)
+ # install workaround
+ pip_run.launch.inject_sitecustomize(str(site_packages))
env = dict(os.environ, PYTHONPATH=str(site_packages))
cmd = [