Skip to content

Commit e1b4e2b

Browse files
committed
docs: document sm_runner fixture for sync/async testing
1 parent 991f4ed commit e1b4e2b

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,21 @@ uv run pytest -n auto
103103

104104
Coverage is enabled by default.
105105

106+
### Testing both sync and async engines
107+
108+
Use the `sm_runner` fixture (from `tests/conftest.py`) when you need to test the same
109+
statechart on both sync and async engines. It is parametrized with `["sync", "async"]`
110+
and provides `start()` / `send()` helpers that handle engine selection automatically:
111+
112+
```python
113+
async def test_something(self, sm_runner):
114+
sm = await sm_runner.start(MyStateChart)
115+
await sm_runner.send(sm, "some_event")
116+
assert "expected_state" in sm.configuration_values
117+
```
118+
119+
Do **not** manually add async no-op listeners or duplicate test classes — prefer `sm_runner`.
120+
106121
## Linting and formatting
107122

108123
```bash

0 commit comments

Comments
 (0)