-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
capsys fails for subprocess calls #3319
Comments
GitMate.io thinks possibly related issues are #623 (capsys: Output is not reported after failing test that called capsys.readouterr()), #2314 (capsys fails to capture the output by stdout), #1164 (test_something fails), #2686 (tmpdir and subprocess fail in CI environment, work locally), and #74 (test_cmdline_python_package() fails). |
capsys unlike capfd does not capture usage of the underlying FD, this is per design |
capfd does not appear to do so either. I ended up using a |
if capfd doesnt do it then thats a bug |
I can definitely repro this with capfd: def test_script_runs(capfd):
with pytest.raises(subprocess.CalledProcessError):
subprocess.check_call("some shell comand", shell=True)
out, err = capfd.readouterr()
assert "usage:" in out
If I remove |
@offbyone which would be a different bug, please report it separately |
On attempting to test external (subprocess) calls, I noticed unexpected failures, even though the output is shown in the 'captured' stdout output area. I have reduced my example code to something like:
My understanding is that pytest should have the marked
xfail
cases above pass (without the marks).attrs (17.4.0)
pip (9.0.1)
pkg-resources (0.0.0)
pluggy (0.6.0)
py (1.5.2)
pytest (3.4.2)
setuptools (38.6.0)
six (1.11.0)
smmap2 (2.0.3)
wheel (0.30.0)
pytest 3.4.2, Debian stretch.
The text was updated successfully, but these errors were encountered: