Skip to content

Commit e9bfdcf

Browse files
committed
streaming bazel output to the terminal
1 parent f932d96 commit e9bfdcf

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

feature_integration_tests/test_cases/conftest.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,25 @@ def pytest_sessionstart(session):
105105

106106
def _build_target(target_name: str) -> None:
107107
command = ["bazel", "build", f"--config={bazel_config}", target_name]
108-
result = subprocess.run(
109-
command,
110-
capture_output=True,
111-
text=True,
112-
check=False,
113-
timeout=build_timeout,
114-
)
108+
try:
109+
result = subprocess.run(
110+
command,
111+
check=False,
112+
timeout=build_timeout,
113+
)
114+
except subprocess.TimeoutExpired as exc:
115+
raise RuntimeError(
116+
"Bazel build timed out while running pytest --build-scenarios.\n"
117+
f"Command: {' '.join(command)}\n"
118+
f"Timeout (seconds): {build_timeout}"
119+
) from exc
120+
115121
if result.returncode != 0:
116-
stderr_tail = "\n".join(result.stderr.strip().splitlines()[-40:])
117-
stdout_tail = "\n".join(result.stdout.strip().splitlines()[-40:])
118122
raise RuntimeError(
119-
"Failed to run build with pytest --build-scenarios.\n"
123+
"Bazel build failed while running pytest --build-scenarios.\n"
120124
f"Command: {' '.join(command)}\n"
121125
f"Return code: {result.returncode}\n"
122-
f"stdout (last lines):\n{stdout_tail}\n"
123-
f"stderr (last lines):\n{stderr_tail}"
126+
"See streamed Bazel output above for details."
124127
)
125128

126129
# Build Rust test scenarios.

0 commit comments

Comments
 (0)