From 45d82be934aed207aeb4c8699a249a81d765e5c5 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Wed, 4 Mar 2026 22:00:00 +0000 Subject: [PATCH 1/2] Fix an intermittent test failure The test `test_thread_with_invocation_id_cancellation_propagates` was failing because I'd set too long a poll interval. This commit drops the poll interval, and it appears to work OK. I have realised we could probably do with a timeout as well as a poll interval: I suspect my intention was to set a timeout of 1 second, not a poll interval of 1 second! The argument was clearly named though - so I don't think we need to change the function. --- tests/test_invocation_contexts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_invocation_contexts.py b/tests/test_invocation_contexts.py index bed21716..657e6347 100644 --- a/tests/test_invocation_contexts.py +++ b/tests/test_invocation_contexts.py @@ -225,7 +225,7 @@ def run_function_in_thread_and_propagate_cancellation(func, *args): t = ThreadWithInvocationID(target=func, args=args) t.start() try: - t.join_and_propagate_cancel(1) + t.join_and_propagate_cancel(0.04) except InvocationCancelledError: # We still want to return the finished thread if it's # cancelled. From 8f8c3d3fe961748aa4309fcb434ce8b31d7b7a4c Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Wed, 4 Mar 2026 22:33:14 +0000 Subject: [PATCH 2/2] Use raw strings for regex patterns with `\[`. This was causing some warnings in the test suite. --- tests/test_server_config_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_server_config_model.py b/tests/test_server_config_model.py index 11010282..6f9cb525 100644 --- a/tests/test_server_config_model.py +++ b/tests/test_server_config_model.py @@ -109,14 +109,14 @@ def test_unimportable_modules(): with pytest.raises( ThingImportFailure, - match="\[RuntimeError\] This module should not be importable!", + match=r"\[RuntimeError\] This module should not be importable!", ): # This checks RuntimErrors get reported with a single error ThingConfig(cls="tests.unimportable.runtimeerror:SomeClass") with pytest.raises( ThingImportFailure, - match="\[ValueError\] This module should not be importable due to ValueError!", + match=r"\[ValueError\] This module should not be importable due to ValueError!", ): # This checks ValueErrors get reported with a single error # rather than getting swallowed by a ValidationError