Skip to content

Commit 3e86a0b

Browse files
committed
test_workflow_failure_types_configured
Run tests sequentially and fix reference to workflow.NondeterminismError
1 parent 35a0e6c commit 3e86a0b

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

tests/worker/test_workflow.py

Lines changed: 22 additions & 24 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
@@ -5040,61 +5041,58 @@ async def run_scenario(
50405041
update_scenario=scenario,
50415042
)
50425043

5043-
# Run all tasks concurrently
5044-
await asyncio.gather(
50455044
# When unconfigured completely, confirm task fails as normal
5046-
run_scenario(
5045+
await run_scenario(
50475046
FailureTypesUnconfiguredWorkflow,
50485047
FailureTypesScenario.THROW_CUSTOM_EXCEPTION,
50495048
expect_task_fail=True,
5050-
),
5051-
run_scenario(
5049+
)
5050+
await run_scenario(
50525051
FailureTypesUnconfiguredWorkflow,
50535052
FailureTypesScenario.CAUSE_NON_DETERMINISM,
50545053
expect_task_fail=True,
5055-
),
5054+
)
50565055
# When configured at the worker level explicitly, confirm not task fail
50575056
# but rather expected exceptions
5058-
run_scenario(
5057+
await run_scenario(
50595058
FailureTypesUnconfiguredWorkflow,
50605059
FailureTypesScenario.THROW_CUSTOM_EXCEPTION,
50615060
worker_level_failure_exception_type=FailureTypesCustomException,
5062-
),
5063-
run_scenario(
5061+
)
5062+
await run_scenario(
50645063
FailureTypesUnconfiguredWorkflow,
50655064
FailureTypesScenario.CAUSE_NON_DETERMINISM,
5066-
worker_level_failure_exception_type=workflow.NondeterminismError,
5067-
),
5065+
worker_level_failure_exception_type=temporalio.workflow.NondeterminismError,
5066+
)
50685067
# When configured at the worker level inherited
5069-
run_scenario(
5068+
await run_scenario(
50705069
FailureTypesUnconfiguredWorkflow,
50715070
FailureTypesScenario.THROW_CUSTOM_EXCEPTION,
50725071
worker_level_failure_exception_type=Exception,
5073-
),
5074-
run_scenario(
5072+
)
5073+
await run_scenario(
50755074
FailureTypesUnconfiguredWorkflow,
50765075
FailureTypesScenario.CAUSE_NON_DETERMINISM,
50775076
worker_level_failure_exception_type=Exception,
5078-
),
5077+
)
50795078
# When configured at the workflow level explicitly
5080-
run_scenario(
5079+
await run_scenario(
50815080
FailureTypesConfiguredExplicitlyWorkflow,
50825081
FailureTypesScenario.THROW_CUSTOM_EXCEPTION,
5083-
),
5084-
run_scenario(
5082+
)
5083+
await run_scenario(
50855084
FailureTypesConfiguredExplicitlyWorkflow,
50865085
FailureTypesScenario.CAUSE_NON_DETERMINISM,
5087-
),
5086+
)
50885087
# When configured at the workflow level inherited
5089-
run_scenario(
5088+
await run_scenario(
50905089
FailureTypesConfiguredInheritedWorkflow,
50915090
FailureTypesScenario.THROW_CUSTOM_EXCEPTION,
5092-
),
5093-
run_scenario(
5091+
)
5092+
await run_scenario(
50945093
FailureTypesConfiguredInheritedWorkflow,
50955094
FailureTypesScenario.CAUSE_NON_DETERMINISM,
5096-
),
5097-
)
5095+
)
50985096

50995097

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

0 commit comments

Comments
 (0)