File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -279,18 +279,23 @@ def wait_sync(self, timeout: Optional[float] = None) -> None:
279279def client () -> Client :
280280 """Return a Temporal Client for use in the current activity.
281281
282+ The client is only available in `async def` activities.
283+
284+ In tests it is not available automatically, but you can pass a client when creating a
285+ :py:class:`temporalio.testing.ActivityEnvironment`.
286+
282287 Returns:
283288 :py:class:`temporalio.client.Client` for use in the current activity.
284289
285290 Raises:
286- RuntimeError: When not in an activity .
291+ RuntimeError: When the client is not available .
287292 """
288293 client = _Context .current ().client
289294 if not client :
290295 raise RuntimeError (
291- "No client available. The client is only available in async "
292- "(i.e. `async def`) activities; not in sync (i.e. `def`) activities. "
293- "In tests you can pass a client when creating ActivityEnvironment."
296+ "No client available. The client is only available in ` async def` "
297+ "activities; not in `def` activities. In tests you can pass a "
298+ "client when creating ActivityEnvironment."
294299 )
295300 return client
296301
You can’t perform that action at this time.
0 commit comments