Skip to content

Commit c83cec4

Browse files
authored
improve error checking (#8157)
1 parent 6911762 commit c83cec4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/transformers/testing_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ def tee(line, sink, pipe, label=""):
849849
# XXX: the timeout doesn't seem to make any difference here
850850
await asyncio.wait(
851851
[
852-
_read_stream(p.stdout, lambda l: tee(l, out, sys.stdout)),
852+
_read_stream(p.stdout, lambda l: tee(l, out, sys.stdout, label="stdout:")),
853853
_read_stream(p.stderr, lambda l: tee(l, err, sys.stderr, label="stderr:")),
854854
],
855855
timeout=timeout,
@@ -869,7 +869,10 @@ def execute_subprocess_async(cmd, env=None, stdin=None, timeout=180, quiet=False
869869
raise RuntimeError(
870870
f"'{cmd_str}' failed with returncode {result.returncode} - see the `stderr:` messages from above for details."
871871
)
872-
if not result.stdout:
872+
873+
# check that the subprocess actually did run and produced some output, should the test rely on
874+
# the remote side to do the testing
875+
if not result.stdout and not result.stderr:
873876
raise RuntimeError(f"'{cmd_str}' produced no output.")
874877

875878
return result

0 commit comments

Comments
 (0)