@@ -3902,7 +3902,7 @@ def matches_metric_line(
39023902 return False
39033903 # Must have labels (don't escape for this test)
39043904 for k , v in at_least_labels .items ():
3905- if not f'{ k } ="{ v } "' in line :
3905+ if f'{ k } ="{ v } "' not in line :
39063906 return False
39073907 return line .endswith (f" { value } " )
39083908
@@ -4856,7 +4856,7 @@ async def assert_scenario(
48564856 update_scenario : Optional [FailureTypesScenario ] = None ,
48574857 ) -> None :
48584858 logging .debug (
4859- f "Asserting scenario %s" ,
4859+ "Asserting scenario %s" ,
48604860 {
48614861 "workflow" : workflow ,
48624862 "expect_task_fail" : expect_task_fail ,
@@ -6054,7 +6054,7 @@ class WorkflowWithWorkflowInit:
60546054 _expected_update_result = "workflow input value"
60556055
60566056 @workflow .init
6057- def __init__ (self , arg : str = "from parameter default" ) -> None :
6057+ def __init__ (self , arg : str ) -> None :
60586058 self .value = arg
60596059
60606060 @workflow .update
@@ -6084,82 +6084,12 @@ async def run(self, _: str) -> str:
60846084 return self .value
60856085
60866086
6087- @workflow .defn (name = "MyWorkflow" )
6088- class WorkflowWithWorkflowInitBaseDecorated :
6089- use_workflow_init = True
6090-
6091- @workflow .init
6092- def __init__ (
6093- self , required_param_that_will_be_supplied_by_child_init_method
6094- ) -> None :
6095- self .value = required_param_that_will_be_supplied_by_child_init_method
6096-
6097- if use_workflow_init :
6098- __init__ = workflow .init (__init__ )
6099-
6100- @workflow .run
6101- async def run (self , _ : str ): ...
6102-
6103- @workflow .update
6104- async def my_update (self ) -> str :
6105- return self .value
6106-
6107-
6108- class WorkflowWithWorkflowInitBaseUndecorated (WorkflowWithWorkflowInitBaseDecorated ):
6109- # The base class does not need the @workflow.init decorator
6110- use_workflow_init = False
6111-
6112-
6113- @workflow .defn (name = "MyWorkflow" )
6114- class WorkflowWithWorkflowInitChild (WorkflowWithWorkflowInitBaseDecorated ):
6115- use_workflow_init = True
6116- _expected_update_result = "workflow input value"
6117-
6118- def __init__ (self , arg : str = "from parameter default" ) -> None :
6119- super ().__init__ ("from child __init__" )
6120- self .value = arg
6121-
6122- if use_workflow_init :
6123- __init__ = workflow .init (__init__ )
6124-
6125- @workflow .run
6126- async def run (self , _ : str ) -> str :
6127- self .value = "set in run method"
6128- return self .value
6129-
6130-
6131- @workflow .defn (name = "MyWorkflow" )
6132- class WorkflowWithWorkflowInitChildNoWorkflowInit (
6133- WorkflowWithWorkflowInitBaseDecorated
6134- ):
6135- use_workflow_init = False
6136- _expected_update_result = "from parameter default"
6137-
6138- def __init__ (self , arg : str = "from parameter default" ) -> None :
6139- super ().__init__ ("from child __init__" )
6140- self .value = arg
6141-
6142- if use_workflow_init :
6143- __init__ = workflow .init (__init__ )
6144-
6145- @workflow .run
6146- async def run (self , _ : str ) -> str :
6147- self .value = "set in run method"
6148- return self .value
6149-
6150-
61516087@pytest .mark .parametrize (
61526088 ["client_cls" , "worker_cls" ],
61536089 [
61546090 (WorkflowWithoutInit , WorkflowWithoutInit ),
61556091 (WorkflowWithNonWorkflowInitInit , WorkflowWithNonWorkflowInitInit ),
61566092 (WorkflowWithWorkflowInit , WorkflowWithWorkflowInit ),
6157- (WorkflowWithWorkflowInitBaseDecorated , WorkflowWithWorkflowInitChild ),
6158- (WorkflowWithWorkflowInitBaseUndecorated , WorkflowWithWorkflowInitChild ),
6159- (
6160- WorkflowWithWorkflowInitBaseUndecorated ,
6161- WorkflowWithWorkflowInitChildNoWorkflowInit ,
6162- ),
61636093 ],
61646094)
61656095async def test_update_in_first_wft_sees_workflow_init (
0 commit comments