Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make test_setup_install_includes_dependencies work with custom PYTHONPATH set #3336

Merged
merged 4 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3336.misc.rst
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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