Skip to content

Commit

Permalink
Make test_setup_install_includes_dependencies work with custom PYTHON…
Browse files Browse the repository at this point in the history
…PATH (#3336)
  • Loading branch information
abravalheri committed Jun 7, 2022
2 parents c0eae60 + fd4a482 commit da436d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelog.d/3336.misc.rst
@@ -0,0 +1 @@
Modified ``test_setup_install_includes_dependencies`` to work with custom ``PYTHONPATH`` –- by :user:`hroncok`
21 changes: 13 additions & 8 deletions setuptools/tests/test_easy_install.py
Expand Up @@ -474,22 +474,27 @@ def test_setup_install_includes_dependencies(self, tmp_path, mock_index):
'--install-purelib', str(install_root),
'--install-platlib', str(install_root),
]
env = {"PYTHONPATH": str(install_root), "__EASYINSTALL_INDEX": mock_index.url}
with pytest.raises(subprocess.CalledProcessError) as exc_info:
subprocess.check_output(
cmd, cwd=str(project_root), env=env, stderr=subprocess.STDOUT, text=True
)
env = {**os.environ, "__EASYINSTALL_INDEX": mock_index.url}
cp = subprocess.run(
cmd,
cwd=str(project_root),
env=env,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
)
assert cp.returncode != 0
try:
assert '/does-not-exist/' in {r.path for r in mock_index.requests}
assert next(
line
for line in exc_info.value.output.splitlines()
for line in cp.stdout.splitlines()
if "not find suitable distribution for" in line
and "does-not-exist" in line
)
except Exception:
if "failed to get random numbers" in exc_info.value.output:
pytest.xfail(f"{sys.platform} failure - {exc_info.value.output}")
if "failed to get random numbers" in cp.stdout:
pytest.xfail(f"{sys.platform} failure - {cp.stdout}")
raise

def create_project(self, root):
Expand Down

0 comments on commit da436d1

Please sign in to comment.