From bd7d507153aa8930113eeb2c60b12a14ec0d9acc Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 10 Jul 2022 21:06:21 -0400 Subject: [PATCH] Guard against `asyncio` cancelled logged to console --- tests/test_docs_examples.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/test_docs_examples.py b/tests/test_docs_examples.py index e1d7867..4139836 100644 --- a/tests/test_docs_examples.py +++ b/tests/test_docs_examples.py @@ -116,9 +116,19 @@ def test_example(run_example_in_subproc, example_script): # print(f'STDOUT: {out}') # if we get some gnarly output let's aggregate and raise - errmsg = err.decode() - errlines = errmsg.splitlines() - if err and 'Error' in errlines[-1]: - raise Exception(errmsg) + if err: + errmsg = err.decode() + errlines = errmsg.splitlines() + 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) assert proc.returncode == 0