Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-140482: Preserve and restorestty 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 ourterms of service andprivacy 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
stty echo as a test environmentstty echo as a test environmentstty echo as a test environmentstty echo as a test environmentThere 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 OutdatedShow 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 intopython: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 commitb3c713a)Co-authored-by: Barry Warsaw <barry@python.org>pythongh-140482: Restore `stty echo` as a test environment
…nt (pythonGH-140519)(cherry picked from commitb3c713a)Co-authored-by: Barry Warsaw <barry@python.org>pythongh-140482: Restore `stty echo` as a test environment
GH-140562 is a backport of this pull request to the3.14 branch. |
GH-140563 is a backport of this pull request to the3.13 branch. |
So which tests fail with this additional check? |
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 |
Just for completeness, it is but other tests also change the environment, e.g. |
Uh oh!
There was an error while loading.Please reload this page.
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.