# Using list\_workflows() in tests

**URL:** <https://community.temporal.io/t/using-list-workflows-in-tests/18609>\
**Category:** Community Support\
**Tags:** python-sdk\
**Created:** [October 29, 2025, 1:05pm UTC](https://community.temporal.io/t/using-list-workflows-in-tests/18609 "2025-10-29T13:05:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Norbert\_Chmiel](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/norbert_chmiel/32/7883_2.png) [@Norbert\_Chmiel](https://community.temporal.io/u/Norbert_Chmiel)\
**Post date:** [October 29, 2025, 1:05pm UTC](https://community.temporal.io/t/using-list-workflows-in-tests/18609/1 "2025-10-29T13:05:40Z")

</div>

I’m trying to test a fastapi method that calls `temporal_client.list_workflows()` to return list of ids of all workflows but I keep getting an error like below:

```python
self = <temporalio.service._BridgeServiceClient object at 0x7fb13894bcb0>, rpc = 'list_workflow_executions'
req = namespace: "default"
page_size: 1000

resp_type = <class 'temporal.api.workflowservice.v1.request_response_pb2.ListWorkflowExecutionsResponse'>

    async def _rpc_call(
        self,
        rpc: str,
        req: google.protobuf.message.Message,
        resp_type: Type[ServiceResponse],
        *,
        service: str,
        retry: bool,
        metadata: Mapping[str, Union[str, bytes]],
        timeout: Optional[timedelta],
    ) -> ServiceResponse:
        global LOG_PROTOS
        if LOG_PROTOS:
            logger.debug("Service %s request to %s: %s", service, rpc, req)
        try:
            client = await self._connected_client()
            resp = await client.call(
                service=service,
                rpc=rpc,
                req=req,
                resp_type=resp_type,
                retry=retry,
                metadata=metadata,
                timeout=timeout,
            )
            if LOG_PROTOS:
                logger.debug("Service %s response from %s: %s", service, rpc, resp)
            return resp
        except temporalio.bridge.client.RPCError as err:
            # Intentionally swallowing the cause instead of using "from"
            status, message, details = err.args
> raise RPCError(message, RPCStatusCode(status), details)
E temporalio.service.RPCError: Method temporal.api.workflowservice.v1.WorkflowService/ListWorkflowExecutions is unimplemented

.venv/lib/python3.13/site-packages/temporalio/service.py:1366: RPCError

```

The implementation of test is as follows:

```python
async def test_list_workflows():
    async with await WorkflowEnvironment.start_time_skipping() as env:
        async with Worker(
            env.client,
            task_queue="python-fastapi-example-queue",
            workflows=[PaymentWorkflow],
            activities=[notify],
        ):
            # Override the temporal client dependency with the test client
            app.dependency_overrides[get_temporal_client_dependency] = (
                lambda: env.client
            )
            with TestClient(app) as test_client:
                response = test_client.get("/workflows")
                assert response.status_code == 200
                assert response.json()["workflows"] == []

```

And the fastapi code:

```python
async def get_temporal_client_dependency() -> Client:
    try:
        return await get_temporal_client()
    except Exception as e:
        raise HTTPException(
            status_code=500, detail=f"Failed to initialize Temporal client: {str(e)}"
        )

app = FastAPI()

@app.get("/workflows")
async def list_workflows(
    temporal_client: Client = Depends(get_temporal_client_dependency),
) -> dict[str, list[str]]:
    workflows = temporal_client.list_workflows()
    ids = []
    async for w in workflows:
        ids.append(w.workflow_id)
    return {"workflows": ids}

```

Is this simply impossible to use in tests or am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![antonio.perez](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/antonio.perez/32/2417_2.png) [@antonio.perez](https://community.temporal.io/u/antonio.perez)\
**Post date:** [October 29, 2025, 6:19pm UTC](https://community.temporal.io/t/using-list-workflows-in-tests/18609/2 "2025-10-29T18:19:33Z")

</div>

Hi,

> ```
> temporalio.service.RPCError: Method temporal.api.workflowservice.v1.WorkflowService/ListWorkflowExecutions is unimplemented
> 
> ```

yes, this is a known issue [Support listWorkflowExecutions in test server · Issue #1693 · temporalio/sdk-java · GitHub](https://github.com/temporalio/sdk-java/issues/1693)

For testing you can use listOpen / listClosedWorkflowExecutions
