diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-22 09:31:40 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-22 09:31:40 -0500 |
commit | 7a1c700e16523ad07532bea2ed87718fe29d3595 (patch) | |
tree | 49337bc88735e3e12e282a1a353d45898a8f082c /setuptools/tests/test_develop.py | |
parent | 5d4b2b691fea992ec47132ba2b01ebd396fe7216 (diff) | |
download | external_python_setuptools-7a1c700e16523ad07532bea2ed87718fe29d3595.tar.gz external_python_setuptools-7a1c700e16523ad07532bea2ed87718fe29d3595.tar.bz2 external_python_setuptools-7a1c700e16523ad07532bea2ed87718fe29d3595.zip |
Re-use test.paths_on_pythonpath to extend the PYTHONPATH variable rather than erasing it. When tests are run under pytest-runner (or other setup.py test invocations), the PYTHONPATH is carefully curated to include dependencies and the project under test. Overwriting PYTHONPATH will break tests in those environments. Fixes #884.
Diffstat (limited to 'setuptools/tests/test_develop.py')
-rw-r--r-- | setuptools/tests/test_develop.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index 430a07e6..5dd72aae 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -10,6 +10,7 @@ import io import subprocess from setuptools.extern import six +from setuptools.command import test import pytest @@ -132,9 +133,9 @@ class TestNamespaces: 'develop', '--install-dir', str(target), ] - env = dict(PYTHONPATH=str(target)) with src_dir.as_cwd(): - subprocess.check_call(develop_cmd, env=env) + with test.test.paths_on_pythonpath([str(target)]): + subprocess.check_call(develop_cmd) @pytest.mark.skipif(bool(os.environ.get("APPVEYOR")), reason="https://github.com/pypa/setuptools/issues/851") @@ -162,12 +163,13 @@ class TestNamespaces: sys.executable, '-c', 'import myns.pkgA; import myns.pkgB', ] - env = dict(PYTHONPATH=str(target)) - subprocess.check_call(try_import, env=env) + with test.test.paths_on_pythonpath([str(target)]): + subprocess.check_call(try_import) # additionally ensure that pkg_resources import works pkg_resources_imp = [ sys.executable, '-c', 'import pkg_resources', ] - subprocess.check_call(pkg_resources_imp, env=env) + with test.test.paths_on_pythonpath([str(target)]): + subprocess.check_call(pkg_resources_imp) |