GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Add a warning when setting up async fixtures · Issue #10839 · pytest-dev/pytest Closed pytest-dev/pytest-asyncio #979Closed Copy link Labels topic: fixturesanything involving fixtures directly or indirectlytype: enhancementnew feature or API change, should be merged into features branch DescriptionWhat's the problem this feature will solve?Pytest cannot evaluate fixture that are async functions or async generators. Users of async pytest plugins may unintentionally annotate those functions with The fixture result ends up to be an unawaited async generator or coroutine, which is not what the user expected. Most of the time, the corresponding tests will fail. However, when the user defines an autouse fixture to perform setup or teardown, the fixture can silently fail. Fixture results in async generatorFixture results in coroutineFixture silently does nothingDescribe the solution you'd likePytest emits the following warning when running async test functions without an async plugin (see #2224): The warning is emitted as part of a trylast hook to I suggest to add the same behavior to the use of Examples
Alternative Solutions#9962 proposes a mechanism to await results of awaitable tests and fixtures. It can potentially address the issue described here. Additional contextFrom the above list of async plugins, only anyio, pytest-asyncio, and pytest-trio make use of pytest_fixture_setup. Reacted by Brian Gianforcaro and Zac Hatfield-Dodds Activity
MetadataMetadataAssigneesLabelstopic: fixturesanything involving fixtures directly or indirectlytype: enhancementnew feature or API change, should be merged into features branch TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |