retcode = call(["ls", "-l"])
+ .. warning::
+
+ Like :meth:`Popen.wait`, this will deadlock if the child process
+ generates enough output to a stdout or stderr pipe such that it blocks
+ waiting for the OS pipe buffer to accept more data.
+
.. function:: check_call(*popenargs, **kwargs)
check_call(["ls", "-l"])
+ .. warning::
+
+ See the warning for :func:`call`.
+
.. function:: check_output(*popenargs, **kwargs)
# All tests are executed with environment variables ignored
# See test_cmd_line_script.py for testing of script execution
+import os
import test.support, unittest
import os
import sys
def exit_code(self, *args):
cmd_line = [sys.executable, '-E']
cmd_line.extend(args)
- return subprocess.call(cmd_line, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ with open(os.devnull, 'w') as devnull:
+ return subprocess.call(cmd_line, stdout=devnull,
+ stderr=subprocess.STDOUT)
def test_directories(self):
self.assertNotEqual(self.exit_code('.'), 0)