Skip to content

Enable pytest-asyncio debug mode - #603

Open
llucax wants to merge 5 commits into
frequenz-floss:v0.x.xfrom
llucax:fix-541
Open

Enable pytest-asyncio debug mode#603
llucax wants to merge 5 commits into
frequenz-floss:v0.x.xfrom
llucax:fix-541

Conversation

@llucax

@llucax llucax commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #541.

@llucax
llucax requested a review from a team as a code owner July 15, 2026 13:49
@llucax
llucax requested review from ela-kotulska-frequenz and removed request for a team July 15, 2026 13:49
@github-actions github-actions Bot added the part:template Affects the cookiecutter template files label Jul 15, 2026
@llucax llucax self-assigned this Jul 15, 2026
@llucax
llucax requested a review from Marenz July 15, 2026 16:26
llucax added 2 commits July 15, 2026 18:27
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Enable pytest-asyncio debug mode by default in generated non-API
repositories so tests benefit from its extra runtime checks.

Keep API repositories unchanged because they do not install
pytest-asyncio, and regenerate all affected golden fixtures.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
llucax added 3 commits July 15, 2026 18:34
Mirror the template change that enables asyncio debug mode so existing
repositories using pytest-asyncio pick it up too.

Insert the setting next to the existing asyncio mode configuration,
preserve explicit `asyncio_debug` values, and skip projects that do not
use `pytest-asyncio`. Report a manual step when the expected pytest
configuration cannot be updated safely.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@Marenz

Marenz commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

🤖 The template change and the migration look right, asyncio_debug was
added in pytest-asyncio 1.2.0 and the template pins 1.3.0.

Two things before I approve:

  1. This repo has no async tests or fixtures at all, but the PR adds
    pytest-asyncio == 1.4.0 to dev-pytest plus required_plugins,
    asyncio_mode and asyncio_debug to its pyproject.toml. Is that
    deliberate (keeping the config in sync with the template), or can it be
    dropped?

  2. The migration doesn't look at the project's pytest-asyncio pin. A repo still
    on < 1.2.0 gets PytestConfigWarning: Unknown config option: asyncio_debug,
    which turns into a failure with the template's filterwarnings = ["error", ...].
    A version check, or at least a hint in the manual step, would avoid that.

Minor: the repo_type == "api" branch is redundant, the generic
"pytest-asyncio" not in content check below already covers it; only
skip-vs-manual-step differs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:template Affects the cookiecutter template files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable asyncio debug mode in tests

3 participants