Skip to content

Commit

Permalink
Added regression test for capfd in a fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Richard authored and nicoddemus committed Aug 18, 2018
1 parent 273670b commit c24c7e7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions testing/test_capture.py
Expand Up @@ -1318,6 +1318,26 @@ def test_capattr():
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),
Expand Down

0 comments on commit c24c7e7

Please sign in to comment.