Added regression test for capfd in a fixture

This commit is contained in:
Tyler Richard 2017-12-26 10:25:25 -08:00 committed by Bruno Oliveira
parent 273670b2a2
commit c24c7e75e2
1 changed files with 20 additions and 0 deletions

View File

@ -1318,6 +1318,26 @@ def test_error_attribute_issue555(testdir):
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)
def test_capfd_after_test(testdir):
testdir.makepyfile("""
import sys
import pytest
import os
@pytest.fixture()
def fix(capfd):
yield
out, err = capfd.readouterr()
assert out == 'lolcatz' + os.linesep
assert err == 'err'
def test_a(fix):
print("lolcatz")
sys.stderr.write("err")
""")
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)
@pytest.mark.skipif(
not sys.platform.startswith("win") and sys.version_info[:2] >= (3, 6),