def test_simple(self, testdir):
testdir.makepyfile("""
import pytest
@pytest.yield_fixture
def arg1():
print ("setup")
yield 1
print ("teardown")
def test_1(arg1):
print ("test1 %s" % arg1)
def test_2(arg1):
print ("test2 %s" % arg1)
assert 0
""")
result = testdir.runpytest("-s")
result.stdout.fnmatch_lines("""
*setup*
*test1 1*
*teardown*
*setup*
*test2 1*
*teardown*
""")
评论列表
文章目录