Explicitly close a file to stop raising a ResourceWarning.

This commit is contained in:
Brett Cannon 2011-08-04 21:34:52 -07:00
parent 087a2a951c
commit a4265546f9

View file

@ -306,12 +306,13 @@ class TestSysConfig(unittest.TestCase):
env = os.environ.copy() env = os.environ.copy()
env['MACOSX_DEPLOYMENT_TARGET'] = '10.1' env['MACOSX_DEPLOYMENT_TARGET'] = '10.1'
with open('/dev/null') as dev_null:
p = subprocess.Popen([ p = subprocess.Popen([
sys.executable, '-c', sys.executable, '-c',
'import sysconfig; print(sysconfig.get_platform())', 'import sysconfig; print(sysconfig.get_platform())',
], ],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=open('/dev/null'), stderr=dev_null,
env=env) env=env)
test_platform = p.communicate()[0].strip() test_platform = p.communicate()[0].strip()
test_platform = test_platform.decode('utf-8') test_platform = test_platform.decode('utf-8')