Skip to content

Commit 6467377

Browse files
Bernd VerstCopilot
andcommitted
Address auto-generated code-quality review comments on PR #145
1. tests/durabletask/test_orchestration_e2e.py (test_suspend_and_resume): Drop the unused `state =` assignment around the expected-timeout `wait_for_orchestration_completion` call. The value is never read because the next line asserts False and the only non-failing path raises TimeoutError; `state` is reassigned a few lines down. Silences the "variable defined multiple times" warning that CodeQL flagged because this previously-untouched line was pulled into the diff by the indent change. 2. tests/durabletask/test_client.py (test_sync_client_context_manager_propagates_exception_and_calls_close): Replace the nested `with pytest.raises(...): with client: raise ...` pattern with an explicit try/except so CodeQL no longer reports the post-block assertions as unreachable. Test intent (exception propagation + cleanup verification) is preserved. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 752b383 commit 6467377

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

tests/durabletask/test_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,9 +791,14 @@ def test_sync_client_context_manager_propagates_exception_and_calls_close():
791791
patch("durabletask.client.stubs.TaskHubSidecarServiceStub", return_value=MagicMock()),
792792
):
793793
client = TaskHubGrpcClient(host_address=HOST_ADDRESS)
794-
with pytest.raises(RuntimeError, match="boom"):
794+
raised = False
795+
try:
795796
with client:
796797
raise RuntimeError("boom")
798+
except RuntimeError as exc:
799+
raised = True
800+
assert str(exc) == "boom"
801+
assert raised, "RuntimeError raised inside the with block must propagate"
797802

798803
assert client._closing is True
799804
channel.close.assert_called_once_with()

tests/durabletask/test_orchestration_e2e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def orchestrator(ctx: task.OrchestrationContext, _):
299299
# Raise an event to the orchestration and confirm that it does NOT complete
300300
task_hub_client.raise_orchestration_event(id, "my_event", data=42)
301301
try:
302-
state = task_hub_client.wait_for_orchestration_completion(id, timeout=3)
302+
task_hub_client.wait_for_orchestration_completion(id, timeout=3)
303303
assert False, "Orchestration should not have completed"
304304
except TimeoutError:
305305
pass

0 commit comments

Comments
 (0)