Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import asyncio
import gc
import multiprocessing
import sys
from typing import AsyncGenerator
from typing import AsyncGenerator, Iterator

import pytest
import pytest_asyncio
Expand Down Expand Up @@ -65,3 +66,14 @@ async def env(request) -> AsyncGenerator[WorkflowEnvironment, None]:
@pytest_asyncio.fixture
async def client(env: WorkflowEnvironment) -> Client:
return env.client


@pytest.fixture(autouse=True)
def collect_garbage_between_tests() -> Iterator[None]:
"""Run the cyclic garbage collector on the main thread after every test.

Otherwise there can be a bug that leads to test stalls, when using CPython
before 3.12 (python/cpython#91351).
"""
yield
gc.collect()
Loading