Fix capturing with --setup-only/--setup-plan

This commit is contained in:
Vasily Kuznetsov
2016-06-23 10:23:04 +02:00
parent ecc97aa3b9
commit 1a5e530b98
3 changed files with 25 additions and 2 deletions

View File

@@ -179,3 +179,24 @@ def test_dynamic_fixture_request(testdir):
'*SETUP F dynamically_requested_fixture',
'*TEARDOWN F dynamically_requested_fixture'
])
def test_capturing(testdir):
p = testdir.makepyfile('''
import pytest, sys
@pytest.fixture()
def one():
sys.stdout.write('this should be captured')
sys.stderr.write('this should also be captured')
@pytest.fixture()
def two(one):
assert 0
def test_capturing(two):
pass
''')
result = testdir.runpytest('--setup-only', p)
result.stdout.fnmatch_lines([
'this should be captured',
'this should also be captured'
])