Files
textual/tests/test_rule.py
TomJGooding 7a9d32fdbf test: make tests async to fix failures on Python 3.9
After upgrading `pytest-asyncio` to the latest version, lots of tests
started failing in CI only on Python 3.9:

`RuntimeError: There is no current event loop in thread 'MainThread'`

Apparently these tests may have only been passing previously due to
issues in earlier versions of `pytest-asyncio`. Changing these tests to
async seems to fix the failures on Python 3.9.

Related issue:
https://github.com/pytest-dev/pytest-asyncio/issues/1039
2025-09-17 13:38:05 +01:00

27 lines
742 B
Python

import pytest
from textual.widgets import Rule
from textual.widgets.rule import InvalidLineStyle, InvalidRuleOrientation
async def test_invalid_rule_orientation():
with pytest.raises(InvalidRuleOrientation):
Rule(orientation="invalid orientation!")
async def test_invalid_rule_line_style():
with pytest.raises(InvalidLineStyle):
Rule(line_style="invalid line style!")
async def test_invalid_reactive_rule_orientation_change():
rule = Rule()
with pytest.raises(InvalidRuleOrientation):
rule.orientation = "invalid orientation!"
async def test_invalid_reactive_rule_line_style_change():
rule = Rule()
with pytest.raises(InvalidLineStyle):
rule.line_style = "invalid line style!"