mirror of
https://github.com/python/cpython.git
synced 2025-09-05 00:11:10 +00:00
utilize subprocess.DEVNULL
This commit is contained in:
parent
a3d6538c12
commit
075bbb176f
1 changed files with 19 additions and 21 deletions
|
@ -305,13 +305,12 @@ class TestSysConfig(unittest.TestCase):
|
||||||
if 'MACOSX_DEPLOYMENT_TARGET' in env:
|
if 'MACOSX_DEPLOYMENT_TARGET' in env:
|
||||||
del env['MACOSX_DEPLOYMENT_TARGET']
|
del env['MACOSX_DEPLOYMENT_TARGET']
|
||||||
|
|
||||||
with open('/dev/null', 'w') as devnull_fp:
|
|
||||||
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=devnull_fp,
|
stderr=subprocess.DEVNULL,
|
||||||
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')
|
||||||
|
@ -325,13 +324,12 @@ 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=dev_null,
|
stderr=subprocess.DEVNULL,
|
||||||
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')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue