Skip to content

Commit 84df6e3

Browse files
authored
docs(python): add note about async fixtures (#33760)
1 parent b9c923f commit 84df6e3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/src/test-runners-python.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,18 @@ def test_bing_is_working(page):
259259
## Deploy to CI
260260

261261
See the [guides for CI providers](./ci.md) to deploy your tests to CI/CD.
262+
263+
## Async Fixtures
264+
265+
If you want to use async fixtures, you can use the [`pytest-playwright-asyncio`](https://pypi.org/project/pytest-playwright-asyncio/) plugin.
266+
Make sure to use `pytest-asyncio>=0.24.0` and make your tests use of [`loop_scope=sesion`](https://pytest-asyncio.readthedocs.io/en/latest/how-to-guides/run_session_tests_in_same_loop.html).
267+
268+
```python
269+
import pytest
270+
from playwright.async_api import Page
271+
272+
@pytest.mark.asyncio(loop_scope="session")
273+
async def test_foo(page: Page):
274+
await page.goto("https://github.com")
275+
# ...
276+
```

0 commit comments

Comments
 (0)