From bdc1ff9195c02328a1cac4cced255f2c055dcf36 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Thu, 29 Oct 2020 10:57:13 -0700 Subject: [PATCH] improve error checking --- src/transformers/testing_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/transformers/testing_utils.py b/src/transformers/testing_utils.py index 4eefb8b0e8f1..4f1e6580b228 100644 --- a/src/transformers/testing_utils.py +++ b/src/transformers/testing_utils.py @@ -849,7 +849,7 @@ def tee(line, sink, pipe, label=""): # XXX: the timeout doesn't seem to make any difference here await asyncio.wait( [ - _read_stream(p.stdout, lambda l: tee(l, out, sys.stdout)), + _read_stream(p.stdout, lambda l: tee(l, out, sys.stdout, label="stdout:")), _read_stream(p.stderr, lambda l: tee(l, err, sys.stderr, label="stderr:")), ], timeout=timeout, @@ -869,7 +869,10 @@ def execute_subprocess_async(cmd, env=None, stdin=None, timeout=180, quiet=False raise RuntimeError( f"'{cmd_str}' failed with returncode {result.returncode} - see the `stderr:` messages from above for details." ) - if not result.stdout: + + # check that the subprocess actually did run and produced some output, should the test rely on + # the remote side to do the testing + if not result.stdout and not result.stderr: raise RuntimeError(f"'{cmd_str}' produced no output.") return result