Check if stty returns the same results ignoring env This test will fail if stdin and stdout are connected to different terminals with different sizes. Nevertheless, such situations should be pretty rare.
(self)
| 3462 | @unittest.skipUnless(hasattr(os, 'get_terminal_size'), |
| 3463 | 'need os.get_terminal_size()') |
| 3464 | def test_stty_match(self): |
| 3465 | """Check if stty returns the same results ignoring env |
| 3466 | |
| 3467 | This test will fail if stdin and stdout are connected to |
| 3468 | different terminals with different sizes. Nevertheless, such |
| 3469 | situations should be pretty rare. |
| 3470 | """ |
| 3471 | try: |
| 3472 | size = subprocess.check_output(['stty', 'size']).decode().split() |
| 3473 | except (FileNotFoundError, PermissionError, |
| 3474 | subprocess.CalledProcessError): |
| 3475 | self.skipTest("stty invocation failed") |
| 3476 | expected = (int(size[1]), int(size[0])) # reversed order |
| 3477 | |
| 3478 | with os_helper.EnvironmentVarGuard() as env: |
| 3479 | env.unset('LINES', 'COLUMNS') |
| 3480 | actual = shutil.get_terminal_size() |
| 3481 | |
| 3482 | self.assertEqual(expected, actual) |
| 3483 | |
| 3484 | @unittest.skipIf(support.is_wasi, "WASI has no /dev/null") |
| 3485 | def test_fallback(self): |
nothing calls this directly
no test coverage detected