Skip to content

Commit 7358e26

Browse files
committed
Revert "gh-140482: Preserve and restore stty echo as a test environment (#140519)"
Reverts #140519 This reverts commit b3c713a. Reason: The PR leads to spurious "ENV CHANGED" failures when running tests in an interactive terminal.
1 parent d3c888b commit 7358e26

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

Lib/test/libregrtest/save_env.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@
99

1010
from .utils import print_warning
1111

12-
# Import termios to save and restore terminal echo. This is only available on
13-
# Unix, and it's fine if the module can't be found.
14-
try:
15-
import termios # noqa: F401
16-
except ModuleNotFoundError:
17-
pass
18-
1912

2013
class SkipTestEnvironment(Exception):
2114
pass
@@ -72,7 +65,6 @@ def __init__(self, test_name, verbose, quiet, *, pgo):
7265
'shutil_archive_formats', 'shutil_unpack_formats',
7366
'asyncio.events._event_loop_policy',
7467
'urllib.requests._url_tempfiles', 'urllib.requests._opener',
75-
'stty_echo',
7668
)
7769

7870
def get_module(self, name):
@@ -300,24 +292,6 @@ def restore_warnings_showwarning(self, fxn):
300292
warnings = self.get_module('warnings')
301293
warnings.showwarning = fxn
302294

303-
def get_stty_echo(self):
304-
termios = self.try_get_module('termios')
305-
if not os.isatty(fd := sys.__stdin__.fileno()):
306-
return None
307-
attrs = termios.tcgetattr(fd)
308-
lflags = attrs[3]
309-
return bool(lflags & termios.ECHO)
310-
def restore_stty_echo(self, echo):
311-
termios = self.get_module('termios')
312-
attrs = termios.tcgetattr(fd := sys.__stdin__.fileno())
313-
if echo:
314-
# Turn echo on.
315-
attrs[3] |= termios.ECHO
316-
else:
317-
# Turn echo off.
318-
attrs[3] &= ~termios.ECHO
319-
termios.tcsetattr(fd, termios.TCSADRAIN, attrs)
320-
321295
def resource_info(self):
322296
for name in self.resources:
323297
method_suffix = name.replace('.', '_')

0 commit comments

Comments
 (0)