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:
90
90
assert result .result == "Name: my custom activity name!"
91
91
92
92
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
+
93
109
async def test_activity_info (
94
110
client : Client , worker : ExternalWorker , env : WorkflowEnvironment
95
111
):
You can’t perform that action at this time.
0 commit comments