We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 51f4b66 commit 30b5503Copy full SHA for 30b5503
tests/worker/test_activity.py
@@ -90,6 +90,22 @@ async def get_name(name: str) -> str:
90
assert result.result == "Name: my custom activity name!"
91
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
109
async def test_activity_info(
110
client: Client, worker: ExternalWorker, env: WorkflowEnvironment
111
):
0 commit comments