mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Always close files in distutils code and tests (#10252).
This commit is contained in:
parent
afb078dd26
commit
bee5cef7db
24 changed files with 261 additions and 171 deletions
|
|
@ -52,7 +52,11 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase):
|
|||
shutil.rmtree(path)
|
||||
|
||||
def write_setup(self, text, path=test.support.TESTFN):
|
||||
open(path, "w").write(text)
|
||||
f = open(path, "w")
|
||||
try:
|
||||
f.write(text)
|
||||
finally:
|
||||
f.close()
|
||||
return path
|
||||
|
||||
def test_run_setup_provides_file(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue