Skip to content

Commit 30b5503

Browse files
committed
Failing test
1 parent 51f4b66 commit 30b5503

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/worker/test_activity.py

+16
Original file line numberDiff line numberDiff 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+
93109
async def test_activity_info(
94110
client: Client, worker: ExternalWorker, env: WorkflowEnvironment
95111
):

0 commit comments

Comments
 (0)