From 8250077297e8385817d97332518bc8fdccc097fb Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Thu, 26 Feb 2026 12:54:17 +0100 Subject: [PATCH 1/2] tests: add sync test for sync_main The existing test_sync_main_runs_fully mocks the loop_function so it didn't catch breakage with python 3.14. --- tests/test_client.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_client.py b/tests/test_client.py index 50096303..4cc0c801 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -245,6 +245,22 @@ def loop_function(): assert len(async_main_calls) == 1 # async_main was called once +def test_sync_main(config): + copyfile(BASIC_TASK, os.path.join(config["work_dir"], "task.json")) + async_main_calls = [] + + async def async_main(*args): + async_main_calls.append(args) + + with tempfile.NamedTemporaryFile("w+") as f: + json.dump(config, f) + f.seek(0) + + client.sync_main(async_main, should_validate_task=False, config_path=f.name) + + assert len(async_main_calls) == 1 # async_main was called once + + @pytest.mark.parametrize( "does_use_argv, default_config", ( From f223de90ae5bb0e43061c2826a3d9e38c5f084db Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Thu, 26 Feb 2026 12:57:20 +0100 Subject: [PATCH 2/2] client: use new_event_loop as default loop_factory Fixes bustage with python 3.14. --- src/scriptworker/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scriptworker/client.py b/src/scriptworker/client.py index 42aa2966..3ba944e3 100644 --- a/src/scriptworker/client.py +++ b/src/scriptworker/client.py @@ -136,7 +136,7 @@ def sync_main( config_path: Optional[str] = None, default_config: Optional[Dict[str, Any]] = None, should_validate_task: bool = True, - loop_function: Callable[[], AbstractEventLoop] = asyncio.get_event_loop, + loop_function: Callable[[], AbstractEventLoop] = asyncio.new_event_loop, ) -> None: """Entry point for scripts using scriptworker. @@ -156,7 +156,7 @@ def sync_main( schema. Defaults to True. loop_function (function, optional): the function to call to get the event loop; here for testing purposes. Defaults to - ``asyncio.get_event_loop``. + ``asyncio.new_event_loop``. """ context = _init_context(config_path, default_config)