mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Explicitly close a file to stop raising a ResourceWarning.
This commit is contained in:
parent
087a2a951c
commit
a4265546f9
1 changed files with 13 additions and 12 deletions
|
|
@ -306,19 +306,20 @@ class TestSysConfig(unittest.TestCase):
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env['MACOSX_DEPLOYMENT_TARGET'] = '10.1'
|
env['MACOSX_DEPLOYMENT_TARGET'] = '10.1'
|
||||||
|
|
||||||
p = subprocess.Popen([
|
with open('/dev/null') as dev_null:
|
||||||
sys.executable, '-c',
|
p = subprocess.Popen([
|
||||||
'import sysconfig; print(sysconfig.get_platform())',
|
sys.executable, '-c',
|
||||||
],
|
'import sysconfig; print(sysconfig.get_platform())',
|
||||||
stdout=subprocess.PIPE,
|
],
|
||||||
stderr=open('/dev/null'),
|
stdout=subprocess.PIPE,
|
||||||
env=env)
|
stderr=dev_null,
|
||||||
test_platform = p.communicate()[0].strip()
|
env=env)
|
||||||
test_platform = test_platform.decode('utf-8')
|
test_platform = p.communicate()[0].strip()
|
||||||
status = p.wait()
|
test_platform = test_platform.decode('utf-8')
|
||||||
|
status = p.wait()
|
||||||
|
|
||||||
self.assertEqual(status, 0)
|
self.assertEqual(status, 0)
|
||||||
self.assertEqual(my_platform, test_platform)
|
self.assertEqual(my_platform, test_platform)
|
||||||
|
|
||||||
|
|
||||||
class MakefileTests(unittest.TestCase):
|
class MakefileTests(unittest.TestCase):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue