(self)
| 2035 | |
| 2036 | @force_not_colorized |
| 2037 | def test_python_basic_repl(self): |
| 2038 | env = os.environ.copy() |
| 2039 | pyrepl_commands = "clear\nexit()\n" |
| 2040 | env.pop("PYTHON_BASIC_REPL", None) |
| 2041 | output, exit_code = self.run_repl(pyrepl_commands, env=env, skip=True) |
| 2042 | self.assertEqual(exit_code, 0) |
| 2043 | self.assertNotIn("Exception", output) |
| 2044 | self.assertNotIn("NameError", output) |
| 2045 | self.assertNotIn("Traceback", output) |
| 2046 | |
| 2047 | basic_commands = "help\nexit()\n" |
| 2048 | env["PYTHON_BASIC_REPL"] = "1" |
| 2049 | output, exit_code = self.run_repl(basic_commands, env=env) |
| 2050 | self.assertEqual(exit_code, 0) |
| 2051 | self.assertIn("Type help() for interactive help", output) |
| 2052 | self.assertNotIn("Exception", output) |
| 2053 | self.assertNotIn("Traceback", output) |
| 2054 | |
| 2055 | # The site module must not load _pyrepl if PYTHON_BASIC_REPL is set |
| 2056 | commands = ("import sys\n" |
| 2057 | "print('_pyrepl' in sys.modules)\n" |
| 2058 | "exit()\n") |
| 2059 | env["PYTHON_BASIC_REPL"] = "1" |
| 2060 | output, exit_code = self.run_repl(commands, env=env) |
| 2061 | self.assertEqual(exit_code, 0) |
| 2062 | self.assertIn("False", output) |
| 2063 | self.assertNotIn("True", output) |
| 2064 | self.assertNotIn("Exception", output) |
| 2065 | self.assertNotIn("Traceback", output) |
| 2066 | |
| 2067 | @force_not_colorized |
| 2068 | def test_no_pyrepl_source_in_exc(self): |
nothing calls this directly
no test coverage detected