Commit Graph

8 Commits

Author SHA1 Message Date
TomJGooding
678ddaf298 Merge branch 'main' into build-update-supported-python-versions 2025-09-29 19:09:01 +01:00
Will McGugan
8226f21595 replace snapshot test 2025-09-28 17:56:03 +01:00
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
Will McGugan
ed1fba2b5b edge case and fix 2024-07-18 15:40:25 +01:00
Will McGugan
5cff594512 tests 2024-03-10 15:16:38 +00:00
Will McGugan
ea8e75661a snapshot 2024-03-09 12:44:22 +00:00
Rodrigo Girão Serrão
79e9f3bc16 Tweak progress bar docs. (#3286)
* Tweak progress bar docs.

There is no good reason as to why the progress bar can't be set back to its indeterminate state (and you could actually do it with code) so this removes the docstring that says that a progress bar can't go back to its indeterminate state.

Related issue: #3268
Related Discord message: https://discord.com/channels/1026214085173461072/1033754296224841768/1149742624002023594

* Use a special sentinal in ProgressBar.update

To comply with https://github.com/Textualize/textual/pull/3286#pullrequestreview-1628601324 we create a new type around a sentinel object and check whether we're using the sentinel before modifying the progress bar reactives.

Things that didn't quite work well:
- directly checking 'if parameter is not _sentinel:' won't satisfy type checkers because that condition doesn't restrict the type of 'parameter' to _not_ be 'UnsetParameter'.
- checking 'isinstance(parameter, float)' isn't enough because the user may call the method with an integer like '3' and then the isinstance check would fail.

- checking 'isinstance(parameter, (int, float))' works but looks a bit odd, plus it is not very general.

* Rework ProgressBar.update with a sentinel value.
2023-09-20 13:51:01 +01:00
Rodrigo Girão Serrão
4148b1d450 Implement a Progress Bar widget. (#2333)
* First prototype of PB.

* Repurpose UnderlineBar.

* Factor out 'Bar' widget.

* Revert "Factor out 'Bar' widget."

This reverts commit 0bb4871adf.

* Add Bar widget.

* Cap progress at 100%.

* Add skeleton for the ETA label.

[skip ci]

* Add ETA display.

* Improve docstrings.

* Directly compute percentage.

* Watch percentage changes directly.

[skip ci]

* Documentation.

* Make reactive percentage private.

Instead, we create a public read-only percentage property.

* Update griffe to fix documentation issue.

Related issues: #1572, https://github.com/mkdocstrings/griffe/issues/128.
Related PRs: https://github.com/mkdocstrings/griffe/pull/135.

* Add example and docs.

* Address review feedback.

[skip ci]

* More documentation.

* Add tests.

* Changelog.

* More tests.

* Fix/fake tests.

* Final tweaks.
2023-04-26 15:25:39 +01:00