Skip to content

Unblock Dependabot: pytest-asyncio loop scope, and a hanging TUI test - #21

Merged
junxit merged 2 commits into
mainfrom
fix/pytest-asyncio-loop-scope
Nov 16, 2026
Merged

junxit merged 2 commits into
mainfrom
fix/pytest-asyncio-loop-scope

Conversation

@junxit

@junxit junxit commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Two fixes that the Dependabot PRs need to go green. Each is a separate commit; merge with rebase to keep them.

1. chore: set pytest-asyncio's fixture loop scope

  • Sets asyncio_default_fixture_loop_scope = "function".
  • With pytest 9.2.0 (chore: bump pytest from 9.1.1 to 9.2.0 #5), pytest-asyncio raises its "option is unset" deprecation warning while pytest configures. CI's -W error turns that into an INTERNALERROR before any test runs.
  • The suite has no async fixtures, so nothing changes behavior.

2. test: let dialogs settle before sending them input (closes #20)

  • test_opening_a_session_does_not_cancel_a_delete clicked Delete as soon as the dialog became the screen. At that point its button can still have an empty region, so the click lands on nothing and wait_for_complete() hangs until the 120 s guard.
  • Shown deterministically: clicked before layout, pilot.click returns False and the dialog stays open. After the dialog settles, the click lands.
  • The new _settled() helper waits for a non-empty, stable region (and for focus, for the export test). The delete test also asserts that its click landed.
  • 45 of 45 runs pass under heavy load, where the old test hung in 3 of 30.

Checked locally: full suite, 1649 passed with -W error, on this branch (pytest 9.1.1, pytest-asyncio 1.5.0); ruff check and ruff format --check clean.

🤖 Generated with Claude Code

- Set asyncio_default_fixture_loop_scope = "function", the scope
  pytest-asyncio will default to
- With pytest 9.2.0, pytest-asyncio's "option is unset" deprecation
  warning is raised while pytest configures, and -W error turns it into
  an internal error before any test runs. This unblocks Dependabot #5
- The suite has no async fixtures, so no fixture changes behavior;
  1649 tests pass with -W error on pytest 9.1.1 and 9.2.0
- The delete test clicked Delete as soon as the dialog became the screen.
  Its buttons can still be unmounted or 0x0 then, so the click landed on
  no widget, the dialog never answered, and wait_for_complete() hung
  until the 120 s guard: 3 of about 7 CI runs, and 3 of 30 local runs
  under heavy load. A test bug, not an app one: nobody can click a
  button before it is drawn
- _settled() waits until the target widget has a non-empty region that
  holds still for a pause (and has focus, for the export test's Enter).
  The delete test also asserts its click landed, so a miss fails at once
- Under heavier load than the original repro, 45 of 45 runs pass

Closes #20
@junxit junxit changed the title chore: set pytest-asyncio's fixture loop scope Unblock Dependabot: pytest-asyncio loop scope, and a hanging TUI test Nov 16, 2026
@junxit
junxit force-pushed the fix/pytest-asyncio-loop-scope branch from a5a2cdb to d326ab6 Compare November 16, 2026 17:39
@junxit
junxit merged commit aedd038 into main Nov 16, 2026
2 checks passed
@junxit
junxit deleted the fix/pytest-asyncio-loop-scope branch November 16, 2026 18:47
junxit pushed a commit that referenced this pull request Nov 16, 2026
- Dependabot update of the dev extra's pytest pin; rebased onto main, and CI (lint, format, tests on macOS) passed on this exact commit
- Needed #21 first: pytest 9.2 raises pytest-asyncio's unset-loop-scope warning at configure, which -W error made fatal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_opening_a_session_does_not_cancel_a_delete hangs intermittently under load

1 participant