Python activity test

Can anyone suggest how to write temporal test case for activity. I was following but it is showing that i am missing client.

Then i referred (
to create client but it gave

async def client(env: WorkflowEnvironment) -> Client:
  return env.client

E AttributeError: ‘async_generator’ object has no attribute ‘client’

Please suggest how can i write the test case for activity in python

You don’t need a client for testing activities. Since they are just functions with a couple of context-available pieces, the temporalio.testing.ActivityEnvironment can be used. See the activity testing section of the Python dev guide.

1 Like