(self)
| 2112 | check(output, exit_code) |
| 2113 | |
| 2114 | def test_not_wiping_history_file(self): |
| 2115 | # skip, if readline module is not available |
| 2116 | import_module('readline') |
| 2117 | |
| 2118 | hfile = tempfile.NamedTemporaryFile(delete=False) |
| 2119 | self.addCleanup(unlink, hfile.name) |
| 2120 | env = os.environ.copy() |
| 2121 | env["PYTHON_HISTORY"] = hfile.name |
| 2122 | commands = "123\nspam\nexit()\n" |
| 2123 | |
| 2124 | env.pop("PYTHON_BASIC_REPL", None) |
| 2125 | output, exit_code = self.run_repl(commands, env=env) |
| 2126 | self.assertEqual(exit_code, 0) |
| 2127 | self.assertIn("123", output) |
| 2128 | self.assertIn("spam", output) |
| 2129 | self.assertNotEqual(pathlib.Path(hfile.name).stat().st_size, 0) |
| 2130 | |
| 2131 | hfile.file.truncate() |
| 2132 | hfile.close() |
| 2133 | |
| 2134 | env["PYTHON_BASIC_REPL"] = "1" |
| 2135 | output, exit_code = self.run_repl(commands, env=env) |
| 2136 | self.assertEqual(exit_code, 0) |
| 2137 | self.assertIn("123", output) |
| 2138 | self.assertIn("spam", output) |
| 2139 | self.assertNotEqual(pathlib.Path(hfile.name).stat().st_size, 0) |
| 2140 | |
| 2141 | @force_not_colorized |
| 2142 | def test_correct_filename_in_syntaxerrors(self): |
nothing calls this directly
no test coverage detected