Terminal tab progress reporting issue #13072#13395
Terminal tab progress reporting issue #13072#13395annatasio wants to merge 2 commits intopytest-dev:mainfrom
Conversation
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
Thanks for starting this.
This feature needs a test and we may need to validate if the terminal supports the codes
Thanks for your immidiate response! I will check these soon. |
nicoddemus
left a comment
There was a problem hiding this comment.
This is great!
Left some minor styling suggestions, but as mentioned by @RonnyPfannschmidt , we need some tests for this.
| total_items = 0 | ||
| if hasattr(self, "_session") and self._session is not None: | ||
| if hasattr(self._session, "items"): | ||
| total_items = len(self._session.items) |
There was a problem hiding this comment.
I don't think we need the hasattr checks given _session is set during __init__ (same for Session.items:
| total_items = 0 | |
| if hasattr(self, "_session") and self._session is not None: | |
| if hasattr(self._session, "items"): | |
| total_items = len(self._session.items) | |
| total_items = len(self._session.items) if self._session is not None else 0 |
| # 1 = set progress value, followed by percentage (0-100) | ||
| progress_sequence = f"\033]9;4;1;{progress}\033\\" | ||
| # Only write the sequence if we're in a terminal | ||
| if hasattr(self._tw, "_file") and self._tw._file.isatty(): |
There was a problem hiding this comment.
I think this if should be done together with if self._show_progress_info, given if this is False we don't need to compute the progress at all. Also we can drop hasattr, as TerminalWriter is always set to a TextIO.
|
Hopefully I can review this some time this week. But I did try this PR out and it seems to work as expected (well, except that the progress stuck around for me after ctrl-c). Here's a video using the Ptyxis terminal: Screencast.From.2025-04-27.00-59-24.mp4 |
|
I think we can implement this in a cleaner way, as an internal plugin. This will avoid complicating TerminalReporter, and also allow to disable the feature if absolutely necessary by blocking the plugin. I will submit a replacement PR (with @annatasio as co-author). |
|
Replaced by #13728, thanks @annatasio. |
No description provided.