diff --git a/test/unit_test/headless/test_dag_managed_tasks.py b/test/unit_test/headless/test_dag_managed_tasks.py index baef2cf9e..ba258d970 100644 --- a/test/unit_test/headless/test_dag_managed_tasks.py +++ b/test/unit_test/headless/test_dag_managed_tasks.py @@ -170,7 +170,15 @@ def endpoint(operation, _body, _timeout): result = run_dag(definition(payload), stop_event=stop) assert not result.succeeded assert result.nodes["one"].result["input_released"] is None - assert calls == ["submit", "get", "pause"] + if reason == "timeout": + # A 10 ms budget: the poll's wait can wake just before the deadline on a coarse + # (Windows) timer and read the status once more before the budget runs out. + assert calls[0] == "submit", calls + assert calls[-1] == "pause", calls + assert calls[1:-1], calls + assert set(calls[1:-1]) == {"get"}, calls + else: + assert calls == ["submit", "get", "pause"] def test_owner_revocation_during_poll_stops_dispatch_and_preserves_review(tmp_path, monkeypatch): diff --git a/test/unit_test/headless/test_remote_clipboard_delivery_gui.py b/test/unit_test/headless/test_remote_clipboard_delivery_gui.py index 65c4c8291..61c336832 100644 --- a/test/unit_test/headless/test_remote_clipboard_delivery_gui.py +++ b/test/unit_test/headless/test_remote_clipboard_delivery_gui.py @@ -7,6 +7,7 @@ import pytest pytest.importorskip('PySide6.QtWidgets', exc_type=ImportError) +from headless._qt_settle import settle from headless.test_remote_registry_owners_gui import qapp as qapp, _tab from je_auto_control.utils.clipboard import clipboard from je_auto_control.utils.rbac import AuthorizationContext, Role, UserStore, authorization_scope, current_authorization @@ -42,6 +43,7 @@ def test_queued_clipboard_from_a_disconnected_gui_viewer_cannot_apply_to_a_repla panel._disconnect() if reconnect: panel._connect() + settle(panel) # the connect runs off the GUI thread; its viewer is adopted when it answers qapp.processEvents() assert applied == [], 'the queued clipboard from the old connection changed local state' if reconnect: