Replies: 3 comments
-
We found the following entry in the FAQ which you may find helpful: Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review. This is an automated reply, generated by FAQtory |
Beta Was this translation helpful? Give feedback.
-
I'm not so familiar with unittest, but this test only takes a second to run on my machine just using pytest along with the pytest-asyncio plugin: from textual.app import App, ComposeResult
from textual.widgets import Input
class PerformanceIssueApp(App):
def compose(self) -> ComposeResult:
yield Input()
async def test_type_text() -> None:
app = PerformanceIssueApp()
async with app.run_test() as pilot:
await pilot.press(*"This is my text!")
input_widget = pilot.app.query_exactly_one(Input)
assert input_widget.value == "This is my text!" |
Beta Was this translation helpful? Give feedback.
-
I can't explain the slowness, but it does look like an issue with unittest, as Tom discovered. The solution is to use pytest style tests, and xdist if you have a lot of them. We have 3000+ tests in Textual, which run in 22 seconds. |
Beta Was this translation helpful? Give feedback.
-
I wrote some custom Input widgets. Unfortunately, testing them is really really slow.
Typing in a simple text like
This is my text!
needs ~15 seconds on my machine. I increasingly think about removing those test. But, of cause this would lead to other issues ... Could you please improve the execution time?Example:
performance_issue_app.py
Output:
Textual Diagnostics
Versions
Python
Operating System
Terminal
Rich Console options
Beta Was this translation helpful? Give feedback.
All reactions