mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +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
|
@ -75,9 +75,11 @@ class SysconfigTestCase(support.EnvironGuard,
|
|||
def test_parse_makefile_base(self):
|
||||
self.makefile = TESTFN
|
||||
fd = open(self.makefile, 'w')
|
||||
fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'" '\n')
|
||||
fd.write('VAR=$OTHER\nOTHER=foo')
|
||||
fd.close()
|
||||
try:
|
||||
fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'" '\n')
|
||||
fd.write('VAR=$OTHER\nOTHER=foo')
|
||||
finally:
|
||||
fd.close()
|
||||
d = sysconfig.parse_makefile(self.makefile)
|
||||
self.assertEquals(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'",
|
||||
'OTHER': 'foo'})
|
||||
|
@ -85,9 +87,11 @@ class SysconfigTestCase(support.EnvironGuard,
|
|||
def test_parse_makefile_literal_dollar(self):
|
||||
self.makefile = TESTFN
|
||||
fd = open(self.makefile, 'w')
|
||||
fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n')
|
||||
fd.write('VAR=$OTHER\nOTHER=foo')
|
||||
fd.close()
|
||||
try:
|
||||
fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n')
|
||||
fd.write('VAR=$OTHER\nOTHER=foo')
|
||||
finally:
|
||||
fd.close()
|
||||
d = sysconfig.parse_makefile(self.makefile)
|
||||
self.assertEquals(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'",
|
||||
'OTHER': 'foo'})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue