Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-140482: Preserve and restore stty echo as a test environment#140519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
warsaw commented Oct 23, 2025 • edited by bedevere-app bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-app bot
Uh oh!
There was an error while loading. Please reload this page.
stty echo as a test environmentstty echo as a test environmentstty echo as a test environmentstty echo as a test environment
zware left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few style nits and a question, but LGTM.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Misc/NEWS.d/next/Tests/2025-10-23-16-39-49.gh-issue-140482.ZMtyeD.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
b3c713a into python:mainUh oh!
There was an error while loading. Please reload this page.
Thanks @warsaw for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…nt (pythonGH-140519) (cherry picked from commit b3c713a) Co-authored-by: Barry Warsaw <[email protected]> pythongh-140482: Restore `stty echo` as a test environment
…nt (pythonGH-140519) (cherry picked from commit b3c713a) Co-authored-by: Barry Warsaw <[email protected]> pythongh-140482: Restore `stty echo` as a test environment
GH-140562 is a backport of this pull request to the 3.14 branch. |
GH-140563 is a backport of this pull request to the 3.13 branch. |
vstinner commented Oct 24, 2025
So which tests fail with this additional check? |
vstinner commented Oct 28, 2025
I reply to myself, Barry already wrote in the issue:
So test_ssl may be the guilty test. At least, we will know which tests change the terminal to |
warsaw commented Oct 28, 2025
Just for completeness, it is but other tests also change the environment, e.g. |
…nvironment (python#140519)" Reverts python#140519 This reverts commit b3c713a. Reason: The PR leads to spurious "ENV CHANGED" failures when running tests in an interactive terminal.
…nt (python#140519) pythongh-140482: Restore `stty echo` as a test environment
The test suite sometimes turns off terminal echo after it completes. As far as I can tell, it's completely random and probably caused by tests that don't (or can't!) fully clean up after themselves. After implementing this fix and testing it many times with
make testandmake quicktest, I see a common set of tests that it happens in, but no real rhyme or reason.This patch just saves and restores
termios.ECHOas a saved test environment and in lots of local testing it works perfectly. Yeah, it's just an annoyance but as #140480 says, this has been annoying me for many releases. Thanks to @zware for suggesting a test environment in my abandoned #140482 PR.I recommend backporting to all active non-security branches as it will help and there should be no risk involved. One caveat is that I did have to change the signature and semantics of
try_get_module()because if the requested module is not already imported,sys.modules[name]will fail, and sincetermiosisn't generally imported,try_get_module()would be unhelpful otherwise. The alternative is to importtermiosat the top of the module so it's always available, but as no other saved test environment seems to do that, and this environment is global rather than tied to a specific test, I thought this was the better approach. Suggestions welcome.