Skip to content

Commit 4f9c987

Browse files
committed
tests: print errors on check=True
1 parent 31de8d8 commit 4f9c987

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tests/conftest.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,17 @@ def run_in_venv(
8383
env = os.environ.copy()
8484
env.update(venv_info["env"])
8585

86-
return subprocess.run(
87-
cmd, shell=True, env=env, capture_output=True, text=True, check=check, **kwargs
88-
)
86+
try:
87+
return subprocess.run(
88+
cmd, shell=True, env=env, capture_output=True, text=True, check=check, **kwargs
89+
)
90+
except subprocess.CalledProcessError as e:
91+
print("Command failed with CalledProcessError.")
92+
print("Exit code:", e.returncode)
93+
print("Command:", e.cmd)
94+
print("Stdout:", e.stdout)
95+
print("Stderr:", e.stderr)
96+
raise
8997

9098

9199
@pytest.fixture(scope="function")

0 commit comments

Comments
 (0)