terminal: disable terminal progress plugin on iTerm2#13897
terminal: disable terminal progress plugin on iTerm2#13897bluetech merged 1 commit intopytest-dev:mainfrom
Conversation
f2316b3 to
c37e687
Compare
| if reporter.isatty(): | ||
| plugin = TerminalProgressPlugin(reporter) | ||
| config.pluginmanager.register(plugin, "terminalprogress") | ||
| # Some terminals interpret OSC 9;4 as desktop notification, | ||
| # skip on those we know (#13896). | ||
| should_skip_terminal_progress = ( | ||
| # iTerm2 (reported on version 3.6.5). | ||
| "ITERM_SESSION_ID" in os.environ | ||
| ) | ||
| if not should_skip_terminal_progress: | ||
| plugin = TerminalProgressPlugin(reporter) | ||
| config.pluginmanager.register(plugin, "terminalprogress") |
There was a problem hiding this comment.
This feels overly nested. How about
| if reporter.isatty(): | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") | |
| # Some terminals interpret OSC 9;4 as desktop notification, | |
| # skip on those we know (#13896). | |
| should_skip_terminal_progress = ( | |
| # iTerm2 (reported on version 3.6.5). | |
| "ITERM_SESSION_ID" in os.environ | |
| ) | |
| if not should_skip_terminal_progress: | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") | |
| # Some terminals interpret OSC 9;4 as desktop notification, | |
| # skip on those we know (#13896). | |
| should_skip_terminal_progress = ( | |
| # iTerm2 (reported on version 3.6.5). | |
| "ITERM_SESSION_ID" in os.environ | |
| ) or not reporter.isatty() | |
| if should_skip_terminal_progress: | |
| return | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") |
?
There was a problem hiding this comment.
I prefer to avoid early return in hooks because it's possible we add more unrelated stuff to it in the future.
There was a problem hiding this comment.
So
| if reporter.isatty(): | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") | |
| # Some terminals interpret OSC 9;4 as desktop notification, | |
| # skip on those we know (#13896). | |
| should_skip_terminal_progress = ( | |
| # iTerm2 (reported on version 3.6.5). | |
| "ITERM_SESSION_ID" in os.environ | |
| ) | |
| if not should_skip_terminal_progress: | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") | |
| # Some terminals interpret OSC 9;4 as desktop notification, | |
| # skip on those we know (#13896). | |
| enable_terminal_progress = ( | |
| # iTerm2 (reported on version 3.6.5). | |
| "ITERM_SESSION_ID" not in os.environ | |
| ) and reporter.isatty() | |
| if enable_terminal_progress: | |
| plugin = TerminalProgressPlugin(reporter) | |
| config.pluginmanager.register(plugin, "terminalprogress") |
then?
There was a problem hiding this comment.
It messes with the comment a bit. The isatty is the more important check, but I want to have a dedicated comment for the entire "unsupported terminals" check (in case we decide to add more cases).
Backport to 9.0.x: 💚 backport PR created✅ Backport PR branch: Backported as #13914 🤖 @patchback |
terminal: disable terminal progress plugin on iTerm2 (cherry picked from commit 1ff8c9b)
…ff8c9b429d888e3f9020d015fa088f828899457/pr-13897 [PR #13897/1ff8c9b4 backport][9.0.x] terminal: disable terminal progress plugin on iTerm2
Fix #13896