Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_subprocess.py @ 68600:eaf93e156dff
Issue #5870: Add subprocess.DEVNULL constant.
| author | Ross Lagerwall <rosslagerwall@gmail.com> |
|---|---|
| date | Wed, 16 Mar 2011 18:40:25 +0200 |
| parents | 27564bbe0fcb |
| children | a161081e8f7c |
line wrap: on
line diff
--- a/Lib/test/test_subprocess.py Wed Mar 16 10:29:37 2011 -0500 +++ b/Lib/test/test_subprocess.py Wed Mar 16 18:40:25 2011 +0200 @@ -323,6 +323,31 @@ 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,
