From 81a68d93ec960f9f4d8ecb537bfbdf4ba915c8bd Mon Sep 17 00:00:00 2001 From: Gael Goinvic Date: Fri, 9 Oct 2026 06:52:56 +0000 Subject: [PATCH] Apply hack to skip regular fixture logic before fixtures could throw This is hidding errors happening during setups, and makes CI difficult to debug. --- newsfragments/1650.internal.md | 1 + tests/integration/conftest.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 newsfragments/1650.internal.md diff --git a/newsfragments/1650.internal.md b/newsfragments/1650.internal.md new file mode 100644 index 00000000..185198aa --- /dev/null +++ b/newsfragments/1650.internal.md @@ -0,0 +1 @@ +CI: Implement a hack workaround of `asyncio-cooperative` hiding fixture errors. diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index f94908d3..a1c90a72 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -22,6 +22,19 @@ def remaining_clusters_teardown(): return +# pytest-asyncio-cooperative fills the fixtures of the marked tests itself. It then clears +# item.fixturenames, so the regular fixture setup does not run them again. But it clears +# them only after the fill: when the fill fails, the regular setup runs the fixtures +# synchronously. Async fixtures return raw coroutines then, and the resulting error masks +# the real one (e.g. a skip becomes a TypeError deep inside another fixture). Clear the +# names here instead: the regular setup does nothing, and the real error raises. +# It's a hook implementation of https://github.com/element-hq/pytest-asyncio-cooperative/pull/2/changes +@pytest.hookimpl(tryfirst=True) +def pytest_runtest_setup(item): + if "asyncio_cooperative" in item.keywords: + item.fixturenames = [] + + def pytest_addoption(parser): parser.addoption("--env-setup", action="store_true", default=False, help="run test env setup")