Open
Description
- a detailed description of the bug or problem you are having
Invoking subprocess.check_output passing in sys.stderr as an argument to stderr within a test makes pytest fail if run with the --capture=sys
or --capture=tee-sys
options.
- output of
pip list
from the virtual environment you are using
Package Version
--------------- ------- attrs 22.2.0
exceptiongroup 1.1.0
iniconfig 2.0.0 packaging 23.0
pip 21.3.1 pluggy 1.0.0
py 1.11.0
pytest 7.2.0 pytest-html 3.2.0
pytest-metadata 2.0.4
pytest-timeout 2.1.0
setuptools 59.6.0
tomli 2.0.1
- pytest and operating system versions
pytest 7.2.0
Fedora Workstation 36
- minimal example if possible
import subprocess
import sys
def test_something():
print("This gets printed")
subprocess.check_output(["echo", "hello"], stderr=sys.stderr)
print("This does not")
When running the file with pytest:
pytest test_itdoesntreallymatter.py --capture=tee-sys --html somepaththatiwant.html --self-contained-html
This generates an UnsupportedOperation
exception.
FAILED test_itdoesntreallymatter.py::test_something - io.UnsupportedOperation: fileno