Skip to content

Commit a97ed1b

Browse files
committed
Make integration tests more verbose
Print each command that is run. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 43ec425 commit a97ed1b

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

tests/integration/test_cookiecutter_generation.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,30 @@
1616
def test_generation(tmp_path: pathlib.Path, repo_type: str) -> None:
1717
"""Test generation of a new repo."""
1818
cwd = pathlib.Path().cwd()
19-
subprocess.run(
20-
[
21-
"cookiecutter",
22-
"--no-input",
23-
cwd / "cookiecutter",
24-
f"type={repo_type}",
25-
"name=test",
26-
"description=Test description",
27-
],
28-
cwd=tmp_path,
29-
check=True,
19+
_run(
20+
tmp_path,
21+
"cookiecutter",
22+
"--no-input",
23+
str(cwd / "cookiecutter"),
24+
f"type={repo_type}",
25+
"name=test",
26+
"description=Test description",
3027
)
28+
3129
subdirs = list(tmp_path.iterdir())
3230
assert len(subdirs) == 1
3331
repo_path = subdirs[0]
34-
subprocess.run("python3 -m venv .venv".split(), cwd=repo_path, check=True)
35-
subprocess.run(
36-
". .venv/bin/activate; pip install .[dev-noxfile]; nox",
37-
shell=True,
38-
cwd=repo_path,
39-
check=True,
40-
)
32+
_run(repo_path, "python3", "-m", "venv", ".venv")
33+
34+
cmd = ". .venv/bin/activate; pip install .[dev-noxfile]; nox"
35+
print()
36+
print(f"Running in shell [{cwd}]: {cmd}")
37+
subprocess.run(cmd, shell=True, cwd=repo_path, check=True)
38+
39+
40+
def _run(cwd: pathlib.Path, *cmd: str) -> subprocess.CompletedProcess[bytes]:
41+
print()
42+
print("-" * 80)
43+
print(f"Running [{cwd}]: {' '.join(cmd)}")
44+
print()
45+
return subprocess.run(cmd, cwd=cwd, check=True)

0 commit comments

Comments
 (0)