Skip to content

Commit

Permalink
Add test to ensure capsys and capfd error out when using "getfixturev…
Browse files Browse the repository at this point in the history
…alue" inside a test
  • Loading branch information
nicoddemus committed Jul 11, 2016
1 parent 0ca0696 commit e206937
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions testing/test_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,22 @@ def test_two(capfd, capsys):
"*capsys*capfd*same*time*",
"*2 error*"])

def test_capturing_getfixturevalue(self, testdir):
testdir.makepyfile("""
def test_one(capsys, request):
request.getfixturevalue("capfd")
def test_two(capfd, request):
request.getfixturevalue("capsys")
""")
result = testdir.runpytest()
result.stdout.fnmatch_lines([
"*test_one*",
"*capsys*capfd*same*time*",
"*test_two*",
"*capsys*capfd*same*time*",
"*2 failed in*",
])

@pytest.mark.parametrize("method", ["sys", "fd"])
def test_capture_is_represented_on_failure_issue128(self, testdir, method):
p = testdir.makepyfile("""
Expand Down

0 comments on commit e206937

Please sign in to comment.