File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,22 @@ async def get_name(name: str) -> str:
9090 assert result .result == "Name: my custom activity name!"
9191
9292
93+ async def test_activity_client (client : Client , worker : ExternalWorker ):
94+ with pytest .raises (RuntimeError ) as err :
95+ activity .client ()
96+ assert str (err .value ) == "Not in activity context"
97+
98+ captured_client : Optional [Client ] = None
99+
100+ @activity .defn
101+ async def capture_client () -> None :
102+ nonlocal captured_client
103+ captured_client = activity .client ()
104+
105+ await _execute_workflow_with_activity (client , worker , capture_client )
106+ assert captured_client is client
107+
108+
93109async def test_activity_info (
94110 client : Client , worker : ExternalWorker , env : WorkflowEnvironment
95111):
You can’t perform that action at this time.
0 commit comments