Fixtures that use capfd don't seem to work in version 3.3.1 running on Ubuntu 14.04 LTS with anaconda 3.6.3
import sys
@pytest.fixture()
def fix(capfd):
yield None
out, err = capfd.readouterr()
stdout_filename = "/tmp/stdout"
stderr_filename = "/tmp/stderr"
mode = 'w'
with open(stdout_filename, mode) as stdout:
stdout.write(out)
with open(stderr_filename, mode) as stderr:
stderr.write(err)
def test_a(fix):
print("lolcatz")
print("this is a test")
sys.stderr.write("err")
The stdout and stderr files end up empty after running that test. Using this set of pytest dependencies
certifi (2017.11.5)
pip (9.0.1)
pluggy (0.6.0)
py (1.5.2)
pytest (3.3.1)
setuptools (38.2.4)
six (1.11.0)
wheel (0.30.0)
Steps of replication are
- Create the above test
- Run pytest on it.
- cat /tmp/std* (they will be empty)
- Downgrade pytest ( pip install autohil==3.2.5 )
- Run the test again
- cat /tmp/std*
Fixtures that use capfd don't seem to work in version 3.3.1 running on Ubuntu 14.04 LTS with anaconda 3.6.3
The stdout and stderr files end up empty after running that test. Using this set of pytest dependencies
Steps of replication are