Skip to content

Commit 51c2291

Browse files
committed
fix: Update pytest-asyncio configuration for worker tests
- Changed asyncio_mode from "strict" to "auto" in pyproject.toml to fix worker fixture issues - Updated testing documentation to explain asyncio configuration - Fixed worker tests that were failing due to async generator handling The auto mode allows for more flexible handling of async/sync code interactions, particularly in worker-related tests where we need to manage both synchronous and asynchronous operations.
1 parent 99d19fc commit 51c2291

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/testing.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,12 @@ pytest --cov=tsignal
8484
# Generate HTML coverage report
8585
pytest --cov=tsignal --cov-report=html
8686
```
87+
88+
## Async Testing Configuration
89+
90+
The project uses `pytest-asyncio` with `asyncio_mode = "auto"` to handle async fixtures and tests. This configuration allows for more flexible handling of async/sync code interactions, especially in worker-related tests where we need to manage both synchronous and asynchronous operations.
91+
92+
Key points:
93+
- Async fixtures can yield values directly
94+
- Both sync and async tests can use the same fixtures
95+
- Worker thread initialization and cleanup are handled automatically

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ markers = [
4949
"asyncio: mark test as an async test",
5050
"performance: mark test as a performance test",
5151
]
52-
asyncio_mode = "strict"
52+
asyncio_mode = "auto"
5353
asyncio_default_fixture_loop_scope = "function"
5454

5555
[tool.coverage.run]

0 commit comments

Comments
 (0)