gh-128770: fix ResourceWarning in test_pyrepl (#128906)

This commit is contained in:
Thomas Grainger 2025-01-22 12:48:33 +00:00 committed by GitHub
parent a16ded10ad
commit 24c84d816f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1324,8 +1324,7 @@ class TestMain(ReplTestCase):
if readline.backend != "editline": if readline.backend != "editline":
self.skipTest("GNU readline is not affected by this issue") self.skipTest("GNU readline is not affected by this issue")
hfile = tempfile.NamedTemporaryFile() with tempfile.NamedTemporaryFile() as hfile:
self.addCleanup(unlink, hfile.name)
env = os.environ.copy() env = os.environ.copy()
env["PYTHON_HISTORY"] = hfile.name env["PYTHON_HISTORY"] = hfile.name