# Python activity test

**URL:** <https://community.temporal.io/t/python-activity-test/10340>\
**Category:** Community Support\
**Tags:** python-sdk\
**Created:** [December 11, 2023, 4:07am UTC](https://community.temporal.io/t/python-activity-test/10340 "2023-12-11T04:07:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sakshi\_Patil](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/sakshi_patil/32/4293_2.png) [@Sakshi\_Patil](https://community.temporal.io/u/Sakshi_Patil)\
**Post date:** [December 11, 2023, 4:07am UTC](https://community.temporal.io/t/python-activity-test/10340/1 "2023-12-11T04:07:43Z")

</div>

Can anyone suggest how to write temporal test case for activity. I was following [https://github.com/temporalio/samples-python/blob/ecdfcd69b7a7894d5ed847549c0f045d41bdcb67/tests/hello/hello\_activity\_test.py#L4](https://github.com/temporalio/samples-python/blob/ecdfcd69b7a7894d5ed847549c0f045d41bdcb67/tests/hello/hello_activity_test.py#L4) but it is showing that i am missing client.

Then i referred ([https://github.com/temporalio/samples-python/blob/ecdfcd69b7a7894d5ed847549c0f045d41bdcb67/tests/conftest.py](https://github.com/temporalio/samples-python/blob/ecdfcd69b7a7894d5ed847549c0f045d41bdcb67/tests/conftest.py))  
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

---

<div class="post-metadata">

**Author:** ![Chad\_Retz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/chad_retz/32/1396_2.png) [@Chad\_Retz](https://community.temporal.io/u/Chad_Retz)\
**Post date:** [December 11, 2023, 1:23pm UTC](https://community.temporal.io/t/python-activity-test/10340/2 "2023-12-11T13:23:51Z")

</div>

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](https://docs.temporal.io/dev-guide/python/testing#test-activities) of the Python dev guide.
