From 5697df211f702e3b283effecb7a8d5863f528ebc Mon Sep 17 00:00:00 2001 From: DanCardin Date: Mon, 12 Sep 2022 15:55:19 -0400 Subject: [PATCH] Perform `in` check against cached fixturedefs (#404) _preprocess_async_fixtures previously checked whether a fixturedef was identical to the fixture cache. This can never be the case. The intent of the if-clause was likely to prevent duplicate evaluation of fixtures. This patch changes the if-statement to check whether the fixturedef is contained in the cache. --- CHANGELOG.rst | 4 ++++ pytest_asyncio/plugin.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8de226c4..0b0f2205 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,10 @@ Changelog ========= +UNRELEASED +================= +- Fixed an issue which prevented fixture setup from being cached. `#404 `_ + 0.19.0 (22-07-13) ================= - BREAKING: The default ``asyncio_mode`` is now *strict*. `#293 `_ diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py index dd6a782b..ce172f5f 100644 --- a/pytest_asyncio/plugin.py +++ b/pytest_asyncio/plugin.py @@ -203,7 +203,7 @@ def _preprocess_async_fixtures(config: Config, holder: Set[FixtureDef]) -> None: fixturemanager = config.pluginmanager.get_plugin("funcmanage") for fixtures in fixturemanager._arg2fixturedefs.values(): for fixturedef in fixtures: - if fixturedef is holder: + if fixturedef in holder: continue func = fixturedef.func if not _is_coroutine_or_asyncgen(func):