diff options
author | Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> | 2025-01-17 13:16:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-17 13:16:10 (GMT) |
commit | 76856ae1659dbba066e51f353b31cb7cf0a8a5fe (patch) | |
tree | 7189e74ece5e1829eb809cc2c62123387be56099 /Lib/test/test_pyrepl/test_pyrepl.py | |
parent | 939df0f9f6a76e0916b3ba53841e1413ab90952e (diff) | |
download | cpython-76856ae1659dbba066e51f353b31cb7cf0a8a5fe.zip cpython-76856ae1659dbba066e51f353b31cb7cf0a8a5fe.tar.gz cpython-76856ae1659dbba066e51f353b31cb7cf0a8a5fe.tar.bz2 |
Revert "gh-128770: raise warnings as errors in test suite - except for test_socket which still logs warnings (#128726)" (#128936)
Diffstat (limited to 'Lib/test/test_pyrepl/test_pyrepl.py')
-rw-r--r-- | Lib/test/test_pyrepl/test_pyrepl.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index 113ea1d..f29a7ff 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -1324,21 +1324,22 @@ class TestMain(ReplTestCase): if readline.backend != "editline": self.skipTest("GNU readline is not affected by this issue") - with tempfile.NamedTemporaryFile() as hfile: - env = os.environ.copy() - env["PYTHON_HISTORY"] = hfile.name - - env["PYTHON_BASIC_REPL"] = "1" - output, exit_code = self.run_repl("spam \nexit()\n", env=env) - self.assertEqual(exit_code, 0) - self.assertIn("spam ", output) - self.assertNotEqual(pathlib.Path(hfile.name).stat().st_size, 0) - self.assertIn("spam\\040", pathlib.Path(hfile.name).read_text()) - - env.pop("PYTHON_BASIC_REPL", None) - output, exit_code = self.run_repl("exit\n", env=env) - self.assertEqual(exit_code, 0) - self.assertNotIn("\\040", pathlib.Path(hfile.name).read_text()) + hfile = tempfile.NamedTemporaryFile() + self.addCleanup(unlink, hfile.name) + env = os.environ.copy() + env["PYTHON_HISTORY"] = hfile.name + + env["PYTHON_BASIC_REPL"] = "1" + output, exit_code = self.run_repl("spam \nexit()\n", env=env) + self.assertEqual(exit_code, 0) + self.assertIn("spam ", output) + self.assertNotEqual(pathlib.Path(hfile.name).stat().st_size, 0) + self.assertIn("spam\\040", pathlib.Path(hfile.name).read_text()) + + env.pop("PYTHON_BASIC_REPL", None) + output, exit_code = self.run_repl("exit\n", env=env) + self.assertEqual(exit_code, 0) + self.assertNotIn("\\040", pathlib.Path(hfile.name).read_text()) def test_keyboard_interrupt_after_isearch(self): output, exit_code = self.run_repl(["\x12", "\x03", "exit"]) |