Skip to content

Commit b6660dd

Browse files
committed
chore: improve logging of errors in demo project nox sessions
1 parent 1c94527 commit b6660dd

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

tests/integration_tests/test_robust_python_demo.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,21 @@ def test_demo_project_generation(robust_python_demo_with_setup: Path) -> None:
1515
@pytest.mark.parametrize("session", GLOBAL_NOX_SESSIONS)
1616
def test_demo_project_nox_session(robust_demo: Path, session: str) -> None:
1717
command: list[str] = ["nox", "-s", session]
18-
subprocess.run(
19-
command,
20-
cwd=robust_demo,
21-
capture_output=True,
22-
text=True,
23-
check=True
24-
)
18+
try:
19+
subprocess.run(
20+
command,
21+
cwd=robust_demo,
22+
stdout=subprocess.PIPE,
23+
stderr=subprocess.STDOUT,
24+
text=True,
25+
check=True
26+
)
27+
except subprocess.CalledProcessError as e:
28+
pytest.fail(
29+
f"nox session '{session}' failed with exit code {e.returncode}\n"
30+
f"{'-'*20} STDOUT {'-'*20}\n{e.stdout}\n"
31+
f"{'-'*20} STDERR {'-'*20}\n{e.stderr}"
32+
)
2533

2634

2735
def test_demo_project_nox_pre_commit(robust_demo: Path) -> None:

0 commit comments

Comments
 (0)