Skip to content

Commit 50471eb

Browse files
committed
Fix tests
1 parent 544b982 commit 50471eb

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

temporalio/client.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3461,8 +3461,16 @@ def __init__(
34613461
if pair.key.name in self.untyped_search_attributes:
34623462
# We know this is mutable here
34633463
del self.untyped_search_attributes[pair.key.name] # type: ignore
3464-
self.static_summary = raw_info.user_metadata.summary
3465-
self.static_details = raw_info.user_metadata.details
3464+
self.static_summary = (
3465+
raw_info.user_metadata.summary
3466+
if raw_info.HasField("user_metadata") and raw_info.user_metadata.summary
3467+
else None
3468+
)
3469+
self.static_details = (
3470+
raw_info.user_metadata.details
3471+
if raw_info.HasField("user_metadata") and raw_info.user_metadata.details
3472+
else None
3473+
)
34663474
else:
34673475
if not id:
34683476
raise ValueError("ID required")

tests/test_client.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,6 @@ async def test_schedule_basics(
780780
pytest.skip("Older proto library cannot compare repeated fields")
781781
await assert_no_schedules(client)
782782

783-
# TODO: Metadata
784-
785783
# Create a schedule with a lot of stuff
786784
schedule = Schedule(
787785
action=ScheduleActionStartWorkflow(
@@ -794,6 +792,8 @@ async def test_schedule_basics(
794792
task_timeout=timedelta(hours=3),
795793
retry_policy=RetryPolicy(maximum_attempts=20),
796794
memo={"memokey1": "memoval1"},
795+
static_summary="summary",
796+
static_details="details",
797797
),
798798
spec=ScheduleSpec(
799799
calendars=[
@@ -864,6 +864,15 @@ async def test_schedule_basics(
864864
day_of_week=(ScheduleRange(1),),
865865
)
866866
)
867+
# Summary & description are encoded
868+
assert schedule.action.static_summary
869+
assert schedule.action.static_details
870+
schedule.action.static_summary = (
871+
await DataConverter.default.encode([schedule.action.static_summary])
872+
)[0]
873+
schedule.action.static_details = (
874+
await DataConverter.default.encode([schedule.action.static_details])
875+
)[0]
867876

868877
# Describe it and confirm
869878
desc = await handle.describe()

tests/worker/test_workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
from temporalio.api.failure.v1 import Failure
4545
from temporalio.api.sdk.v1 import EnhancedStackTrace
4646
from temporalio.api.workflowservice.v1 import (
47+
DescribeWorkflowExecutionRequest,
4748
GetWorkflowExecutionHistoryRequest,
4849
ResetStickyTaskQueueRequest,
49-
DescribeWorkflowExecutionRequest
5050
)
5151
from temporalio.bridge.proto.workflow_activation import WorkflowActivation
5252
from temporalio.bridge.proto.workflow_completion import WorkflowActivationCompletion
@@ -505,7 +505,7 @@ async def test_workflow_signal_and_query_errors(client: Client):
505505
await handle.query("non-existent query")
506506
assert str(rpc_err.value) == (
507507
"Query handler for 'non-existent query' expected but not found,"
508-
" known queries: [__enhanced_stack_trace __stack_trace bad_query other_query]"
508+
" known queries: [__enhanced_stack_trace __stack_trace __temporal_workflow_metadata bad_query other_query]"
509509
)
510510

511511

0 commit comments

Comments
 (0)