diff --git a/tests/test_client.py b/tests/test_client.py index 52b8e75..cfbe1f9 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -308,26 +308,31 @@ def notebook_resources(): def filter_messages_on_error_output(err_output): - allowed_lines = [ + allowed_prefixes = [ # ipykernel might be installed without debugpy extension - "[IPKernelApp] WARNING | debugpy_stream undefined, debugging will not be enabled", + "[IPKernelApp] WARNING | debugpy_stream undefined", + # ipykernel warns when kernel runs over TCP without CurveZMQ encryption + "[IPKernelApp] WARNING | Kernel is running over TCP without encryption.", + ] + filtered_result = [ + line + for line in err_output.splitlines() + if not any(line.startswith(prefix) for prefix in allowed_prefixes) ] - lines = err_output.splitlines() # Known benign race condition: kernel sends a status message on a socket already # closed during parallel shutdown. Filter the entire traceback block. in_zmq_traceback = False - filtered_result = [] - for line in lines: + final_filtered_result = [] + for line in filtered_result: if "ERROR:tornado.general:Uncaught exception in ZMQStream callback" in line: in_zmq_traceback = True if in_zmq_traceback: if "zmq.error.ZMQError: Socket operation on non-socket" in line: in_zmq_traceback = False continue - if line not in allowed_lines: - filtered_result.append(line) + final_filtered_result.append(line) - return os.linesep.join(filtered_result) + return os.linesep.join(final_filtered_result) @pytest.mark.parametrize(