feat: Raise exception in tests when blocking code is called in event loop (#4293)

Raise exception in tests when blocking code is called in event loop
This commit is contained in:
Christophe Bornet 2024-11-02 17:03:31 +01:00 • committed by GitHub
commit 14b3117d6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 596 additions and 46 deletions

View file

@ -1,3 +1,4 @@
import asyncio
import json
from typing import NamedTuple
from uuid import UUID, uuid4
@ -604,7 +605,7 @@ async def test_delete_nonexistent_flow(client: AsyncClient, logged_in_headers):
@pytest.mark.usefixtures("active_user")
async def test_read_only_starter_projects(client: AsyncClient, logged_in_headers):
response = await client.get("api/v1/flows/basic_examples/", headers=logged_in_headers)
starter_projects = load_starter_projects()
starter_projects = await asyncio.to_thread(load_starter_projects)
assert response.status_code == 200
assert len(response.json()) == len(starter_projects)