Skip to content

Commit 366cf63

Browse files
committed
Test install --check failing
1 parent 26995f4 commit 366cf63

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/test_workflow.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,48 @@ def test_whole_workflow(tmpdir):
253253
"--_fast",
254254
]
255255
)
256+
257+
258+
@pytest.mark.long_running
259+
def test_check_install_fail(tmpdir):
260+
repo = tmpdir / "repo"
261+
venv_dir = repo / "outer_venv"
262+
bench_runner_checkout = DATA_PATH.parents[1]
263+
if sys.platform.startswith("win"):
264+
binary = venv_dir / "Scripts" / "python.exe"
265+
else:
266+
binary = venv_dir / "bin" / "python"
267+
268+
repo.mkdir()
269+
270+
with contextlib.chdir(repo):
271+
subprocess.check_call([sys.executable, "-m", "venv", str(venv_dir)])
272+
subprocess.check_call(
273+
[
274+
str(binary),
275+
"-m",
276+
"pip",
277+
"install",
278+
"--upgrade",
279+
"pip",
280+
]
281+
)
282+
subprocess.check_call(
283+
[str(binary), "-m", "pip", "install", f"{bench_runner_checkout}[test]"]
284+
)
285+
subprocess.check_call([str(binary), "-m", "bench_runner", "install"])
286+
287+
# Now edit one of the generated files to make the check fail
288+
with open("workflow_bootstrap.py", "a") as fd:
289+
fd.write("# EXTRA CONTENT\n\n")
290+
291+
with pytest.raises(subprocess.CalledProcessError):
292+
subprocess.check_call(
293+
[
294+
str(binary),
295+
"-m",
296+
"bench_runner",
297+
"install",
298+
"--check",
299+
]
300+
)

0 commit comments

Comments
 (0)