Guard against asyncio canclled logged to console

sigintsaviour_citesthackin
Tyler Goodlet 2022-07-10 21:06:21 -04:00
parent f7823a46b8
commit b2fdbc44d1
1 changed files with 14 additions and 4 deletions

View File

@ -116,9 +116,19 @@ def test_example(run_example_in_subproc, example_script):
# print(f'STDOUT: {out}') # print(f'STDOUT: {out}')
# if we get some gnarly output let's aggregate and raise # if we get some gnarly output let's aggregate and raise
if err:
errmsg = err.decode() errmsg = err.decode()
errlines = errmsg.splitlines() errlines = errmsg.splitlines()
if err and 'Error' in errlines[-1]: last_error = errlines[-1]
if (
'Error' in last_error
# XXX: currently we print this to console, but maybe
# shouldn't eventually once we figure out what's
# a better way to be explicit about aio side
# cancels?
and 'asyncio.exceptions.CancelledError' not in last_error
):
raise Exception(errmsg) raise Exception(errmsg)
assert proc.returncode == 0 assert proc.returncode == 0