|
9 | 9 |
|
10 | 10 | from .utils import print_warning |
11 | 11 |
|
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 | | - |
19 | 12 |
|
20 | 13 | class SkipTestEnvironment(Exception): |
21 | 14 | pass |
@@ -72,7 +65,6 @@ def __init__(self, test_name, verbose, quiet, *, pgo): |
72 | 65 | 'shutil_archive_formats', 'shutil_unpack_formats', |
73 | 66 | 'asyncio.events._event_loop_policy', |
74 | 67 | 'urllib.requests._url_tempfiles', 'urllib.requests._opener', |
75 | | - 'stty_echo', |
76 | 68 | ) |
77 | 69 |
|
78 | 70 | def get_module(self, name): |
@@ -300,24 +292,6 @@ def restore_warnings_showwarning(self, fxn): |
300 | 292 | warnings = self.get_module('warnings') |
301 | 293 | warnings.showwarning = fxn |
302 | 294 |
|
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 | | - |
321 | 295 | def resource_info(self): |
322 | 296 | for name in self.resources: |
323 | 297 | method_suffix = name.replace('.', '_') |
|
0 commit comments