Skip to content

Commit ad14060

Browse files
committed
test_workflow_failure_types_configured
Run tests sequentially and fix reference to workflow.NondeterminismError
1 parent fd4b79d commit ad14060

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

tests/worker/test_workflow.py

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from typing_extensions import Literal, Protocol, runtime_checkable
3939

4040
import temporalio.worker
41+
import temporalio.workflow
4142
from temporalio import activity, workflow
4243
from temporalio.api.common.v1 import Payload, Payloads, WorkflowExecution
4344
from temporalio.api.enums.v1 import EventType
@@ -85,7 +86,6 @@
8586
ApplicationError,
8687
CancelledError,
8788
ChildWorkflowError,
88-
FailureError,
8989
TemporalError,
9090
TimeoutError,
9191
WorkflowAlreadyStartedError,
@@ -5041,61 +5041,58 @@ async def run_scenario(
50415041
update_scenario=scenario,
50425042
)
50435043

5044-
# Run all tasks concurrently
5045-
await asyncio.gather(
50465044
# When unconfigured completely, confirm task fails as normal
5047-
run_scenario(
5045+
await run_scenario(
50485046
FailureTypesUnconfiguredWorkflow,
50495047
FailureTypesScenario.THROW_CUSTOM_EXCEPTION,
50505048
expect_task_fail=True,
5051-
),
5052-
run_scenario(
5049+
)
5050+
await run_scenario(
50535051
FailureTypesUnconfiguredWorkflow,
50545052
FailureTypesScenario.CAUSE_NON_DETERMINISM,
50555053
expect_task_fail=True,
5056-
),
5054+
)
50575055
# When configured at the worker level explicitly, confirm not task fail
50585056
# but rather expected exceptions
5059-
run_scenario(
5057+
await run_scenario(
50605058
FailureTypesUnconfiguredWorkflow,
50615059
FailureTypesScenario.THROW_CUSTOM_EXCEPTION,
50625060
worker_level_failure_exception_type=FailureTypesCustomException,
5063-
),
5064-
run_scenario(
5061+
)
5062+
await run_scenario(
50655063
FailureTypesUnconfiguredWorkflow,
50665064
FailureTypesScenario.CAUSE_NON_DETERMINISM,
5067-
worker_level_failure_exception_type=workflow.NondeterminismError,
5068-
),
5065+
worker_level_failure_exception_type=temporalio.workflow.NondeterminismError,
5066+
)
50695067
# When configured at the worker level inherited
5070-
run_scenario(
5068+
await run_scenario(
50715069
FailureTypesUnconfiguredWorkflow,
50725070
FailureTypesScenario.THROW_CUSTOM_EXCEPTION,
50735071
worker_level_failure_exception_type=Exception,
5074-
),
5075-
run_scenario(
5072+
)
5073+
await run_scenario(
50765074
FailureTypesUnconfiguredWorkflow,
50775075
FailureTypesScenario.CAUSE_NON_DETERMINISM,
50785076
worker_level_failure_exception_type=Exception,
5079-
),
5077+
)
50805078
# When configured at the workflow level explicitly
5081-
run_scenario(
5079+
await run_scenario(
50825080
FailureTypesConfiguredExplicitlyWorkflow,
50835081
FailureTypesScenario.THROW_CUSTOM_EXCEPTION,
5084-
),
5085-
run_scenario(
5082+
)
5083+
await run_scenario(
50865084
FailureTypesConfiguredExplicitlyWorkflow,
50875085
FailureTypesScenario.CAUSE_NON_DETERMINISM,
5088-
),
5086+
)
50895087
# When configured at the workflow level inherited
5090-
run_scenario(
5088+
await run_scenario(
50915089
FailureTypesConfiguredInheritedWorkflow,
50925090
FailureTypesScenario.THROW_CUSTOM_EXCEPTION,
5093-
),
5094-
run_scenario(
5091+
)
5092+
await run_scenario(
50955093
FailureTypesConfiguredInheritedWorkflow,
50965094
FailureTypesScenario.CAUSE_NON_DETERMINISM,
5097-
),
5098-
)
5095+
)
50995096

51005097

51015098
@workflow.defn(failure_exception_types=[Exception])

0 commit comments

Comments
 (0)