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

Fix tests not using an absolute or relative path with Process #11454

Merged
merged 1 commit into from
Jan 13, 2021
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
9 changes: 4 additions & 5 deletions src/python/pants/backend/python/util_rules/pex_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,11 @@ def test_pex_execution(rule_runner: RuleRunner) -> None:
assert "main.py" in pex_files
assert "subdir/sub.py" in pex_files

# We reasonably expect there to be a python interpreter on the test-running process's path.
env = {"PATH": os.getenv("PATH", "")}

# This should run the Pex using the same interpreter used to create it. We must set the `PATH` so that the shebang
# works.
process = Process(
argv=("python", "test.pex"),
env=env,
argv=("./test.pex",),
env={"PATH": os.getenv("PATH", "")},
input_digest=pex_output["pex"].digest,
description="Run the pex and make sure it works",
)
Expand Down
6 changes: 3 additions & 3 deletions tests/python/pants_test/init/test_plugin_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def _run_setup_py(
)
merged_digest = rule_runner.request(Digest, [MergeDigests([pex_obj.digest, source_digest])])

# This should run the Pex using the same interpreter used to create it. We must set the `PATH` so that the shebang
# works.
process = Process(
argv=("python", "setup-py-runner.pex", "setup.py") + tuple(setup_py_args),
# We reasonably expect there to be a python interpreter on the test-running
# process's path.
argv=("./setup-py-runner.pex", "setup.py", *setup_py_args),
env={"PATH": os.getenv("PATH", "")},
input_digest=merged_digest,
description="Run setup.py",
Expand Down