diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2011-03-16 18:40:25 +0200 |
---|---|---|
committer | Ross Lagerwall <rosslagerwall@gmail.com> | 2011-03-16 18:40:25 +0200 |
commit | ba102ec10d953af825e0da4c3cff02a701d3ca81 (patch) | |
tree | cf8b734f1e3a007082e83f410fdb6521483663f5 /Lib/test/test_subprocess.py | |
parent | 09bb8f46aa08fdcc4ec4b7c791d550fd71ae9f60 (diff) | |
download | cpython-git-ba102ec10d953af825e0da4c3cff02a701d3ca81.tar.gz |
Issue #5870: Add subprocess.DEVNULL constant.
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r-- | Lib/test/test_subprocess.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 5f158b9b64..31565432b0 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -323,6 +323,31 @@ class ProcessTestCase(BaseTestCase): rc = subprocess.call([sys.executable, "-c", cmd], stdout=1) self.assertEqual(rc, 2) + def test_stdout_devnull(self): + p = subprocess.Popen([sys.executable, "-c", + 'for i in range(10240):' + 'print("x" * 1024)'], + stdout=subprocess.DEVNULL) + p.wait() + self.assertEqual(p.stdout, None) + + def test_stderr_devnull(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys\n' + 'for i in range(10240):' + 'sys.stderr.write("x" * 1024)'], + stderr=subprocess.DEVNULL) + p.wait() + self.assertEqual(p.stderr, None) + + def test_stdin_devnull(self): + p = subprocess.Popen([sys.executable, "-c", + 'import sys;' + 'sys.stdin.read(1)'], + stdin=subprocess.DEVNULL) + p.wait() + self.assertEqual(p.stdin, None) + def test_cwd(self): tmpdir = tempfile.gettempdir() # We cannot use os.path.realpath to canonicalize the path, |