[issue40707] Popen.communicate documentation does not say how to get the return code

Gareth Rees report at bugs.python.org
Sat May 23 04:23:19 EDT 2020


Gareth Rees <gdr at garethrees.org> added the comment:

The following test cases in test_subprocess.py call the communicate() method and then immediately assert that returncode attribute has the expected value:

* test_stdout_none
* test_stderr_redirect_with_no_stdout_redirect
* test_stdout_filedes_of_stdout
* test_communicate_stdin
* test_universal_newlines_communicate_stdin
* test_universal_newlines_communicate_input_none
* test_universal_newlines_communicate_stdin_stdout_stderr
* test_nonexisting_with_pipes
* test_wait_when_sigchild_ignored
* test_startupinfo_copy
* test_close_fds_with_stdio
* test_communicate_stdin

You'll see that some of these test for success (returncode == 0) and some for failure (returncode == 1). This seems like adequate test coverage to me, but if something is missing, let me know.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40707>
_______________________________________


More information about the Python-bugs-list mailing list