|
11 | 11 | from unittest import TestCase, skipUnless, skipIf
|
12 | 12 | from unittest.mock import patch
|
13 | 13 | from test.support import force_not_colorized, make_clean_env
|
14 |
| -from test.support import SHORT_TIMEOUT, STDLIB_DIR |
| 14 | +from test.support import SHORT_TIMEOUT |
15 | 15 | from test.support.import_helper import import_module
|
16 |
| -from test.support.os_helper import EnvironmentVarGuard, unlink |
| 16 | +from test.support.os_helper import unlink |
17 | 17 |
|
18 | 18 | from .support import (
|
19 | 19 | FakeConsole,
|
@@ -1416,31 +1416,6 @@ def test_python_basic_repl(self):
|
1416 | 1416 | self.assertNotIn("Exception", output)
|
1417 | 1417 | self.assertNotIn("Traceback", output)
|
1418 | 1418 |
|
1419 |
| - @force_not_colorized |
1420 |
| - def test_no_pyrepl_source_in_exc(self): |
1421 |
| - # Avoid using _pyrepl/__main__.py in traceback reports |
1422 |
| - # See https://github.com/python/cpython/issues/129098. |
1423 |
| - pyrepl_main_file = os.path.join(STDLIB_DIR, "_pyrepl", "__main__.py") |
1424 |
| - self.assertTrue(os.path.exists(pyrepl_main_file), pyrepl_main_file) |
1425 |
| - with open(pyrepl_main_file) as fp: |
1426 |
| - excluded_lines = fp.readlines() |
1427 |
| - excluded_lines = list(filter(None, map(str.strip, excluded_lines))) |
1428 |
| - |
1429 |
| - for filename in ['?', 'unknown-filename', '<foo>', '<...>']: |
1430 |
| - self._test_no_pyrepl_source_in_exc(filename, excluded_lines) |
1431 |
| - |
1432 |
| - def _test_no_pyrepl_source_in_exc(self, filename, excluded_lines): |
1433 |
| - with EnvironmentVarGuard() as env, self.subTest(filename=filename): |
1434 |
| - env.unset("PYTHON_BASIC_REPL") |
1435 |
| - commands = (f"eval(compile('spam', {filename!r}, 'eval'))\n" |
1436 |
| - f"exit()\n") |
1437 |
| - output, _ = self.run_repl(commands, env=env) |
1438 |
| - self.assertIn("Traceback (most recent call last)", output) |
1439 |
| - self.assertIn("NameError: name 'spam' is not defined", output) |
1440 |
| - for line in excluded_lines: |
1441 |
| - with self.subTest(line=line): |
1442 |
| - self.assertNotIn(line, output) |
1443 |
| - |
1444 | 1419 | @force_not_colorized
|
1445 | 1420 | def test_bad_sys_excepthook_doesnt_crash_pyrepl(self):
|
1446 | 1421 | env = os.environ.copy()
|
|
0 commit comments