Skip to content

Tests fail with pytest-asyncio>=0.25.0 #5511

Closed
@gepbird

Description

@gepbird

Tested with textual version 1.0.0 and python version 3.12.8

When updating pytest-asyncio to from 0.24.0 to 0.25.0, some tests start failing:

=========================== short test summary info ============================
FAILED tests/test_focus.py::test_focus_chain - RuntimeError: There is no current event loop in thread 'MainThread'.
FAILED tests/test_focus.py::test_allow_focus - RuntimeError: There is no current event loop in thread 'MainThread'.
FAILED tests/test_focus.py::test_focus_next_and_previous_with_type_selector_without_self - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR tests/test_focus.py::test_focus_next_wrap_around - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR tests/test_focus.py::test_focus_next_and_previous - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR tests/test_focus.py::test_focus_previous_wrap_around - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR tests/test_focus.py::test_no_focus_empty_selector - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR tests/test_focus.py::test_wrap_around_selector - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR tests/test_focus.py::test_focus_next_and_previous_with_type_selector - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR tests/test_focus.py::test_focus_next_and_previous_with_str_selector - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR tests/test_focus.py::test_focus_next_and_previous_with_str_selector_without_self - RuntimeError: There is no current event loop in thread 'MainThread'.

Re-running just the failed tests makes them pass, to reproduce this you need to run the whole test suite or at least a larger part.

Possibly related upstream issues:

We noticed this failure in nixpkgs where we recently bumped many python packages and some of textual's tests started failing: https://hydra.nixos.org/job/nixpkgs/trunk/python312Packages.textual.x86_64-linux

Textual Diagnostics

Versions

Name Value
Textual 1.0.0
Rich 13.9.4

Python

Name Value
Version 3.12.8
Implementation CPython
Compiler GCC 14.2.1 20241116
Executable /home/gep/.cache/pypoetry/virtualenvs/textual-y4dff5Fy-py3.12/bin/python

Operating System

Name Value
System Linux
Release 6.12.10-zen1
Version #1-NixOS ZEN SMP PREEMPT_DYNAMIC Tue Jan 1 00:00:00 UTC 1980

Terminal

Name Value
Terminal Application tmux (3.5a)
TERM screen
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=210, height=54
legacy_windows False
min_width 1
max_width 210
is_terminal False
encoding utf-8
max_height 54
justify None
overflow None
no_wrap False
highlight None
markup None
height None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions