diff options
author | Philip Jenvey <pjenvey@underboss.org> | 2012-10-01 18:48:46 (GMT) |
---|---|---|
committer | Philip Jenvey <pjenvey@underboss.org> | 2012-10-01 18:48:46 (GMT) |
commit | 075bbb176f69e3da013e39d847caaea9b0cee334 (patch) | |
tree | 99619e853d465e54a2a17a8cd5c4b743c0d05ad1 | |
parent | a3d6538c126fc050f2ebcac9e61b5849652cd04b (diff) | |
download | cpython-075bbb176f69e3da013e39d847caaea9b0cee334.zip cpython-075bbb176f69e3da013e39d847caaea9b0cee334.tar.gz cpython-075bbb176f69e3da013e39d847caaea9b0cee334.tar.bz2 |
utilize subprocess.DEVNULL
-rw-r--r-- | Lib/test/test_sysconfig.py | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 9219360..c44e192 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -305,14 +305,13 @@ class TestSysConfig(unittest.TestCase): if 'MACOSX_DEPLOYMENT_TARGET' in env: del env['MACOSX_DEPLOYMENT_TARGET'] - with open('/dev/null', 'w') as devnull_fp: - p = subprocess.Popen([ - sys.executable, '-c', - 'import sysconfig; print(sysconfig.get_platform())', - ], - stdout=subprocess.PIPE, - stderr=devnull_fp, - env=env) + p = subprocess.Popen([ + sys.executable, '-c', + 'import sysconfig; print(sysconfig.get_platform())', + ], + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + env=env) test_platform = p.communicate()[0].strip() test_platform = test_platform.decode('utf-8') status = p.wait() @@ -325,20 +324,19 @@ class TestSysConfig(unittest.TestCase): env = os.environ.copy() env['MACOSX_DEPLOYMENT_TARGET'] = '10.1' - with open('/dev/null') as dev_null: - p = subprocess.Popen([ - sys.executable, '-c', - 'import sysconfig; print(sysconfig.get_platform())', - ], - stdout=subprocess.PIPE, - stderr=dev_null, - env=env) - test_platform = p.communicate()[0].strip() - test_platform = test_platform.decode('utf-8') - status = p.wait() - - self.assertEqual(status, 0) - self.assertEqual(my_platform, test_platform) + p = subprocess.Popen([ + sys.executable, '-c', + 'import sysconfig; print(sysconfig.get_platform())', + ], + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + env=env) + test_platform = p.communicate()[0].strip() + test_platform = test_platform.decode('utf-8') + status = p.wait() + + self.assertEqual(status, 0) + self.assertEqual(my_platform, test_platform) def test_srcdir(self): # See Issues #15322, #15364. |