【发布时间】:2019-12-30 20:47:24
【问题描述】:
我已经定义了一个像这样的夹具:
@pytest.fixture
def mock_yield_data(self):
for data in [
{
1: 2, 2: 3
},
{
2: 4, 4: 5
},
]:
yield data
以及类似的测试方法:
def test_fixture(self, mock_yield_data):
for data in mock_yield_data:
assert data
断言成功,但teardown 抛出,yield_fixture function has more than one 'yield':。
==================================================================================================== ERRORS ====================================================================================================
_________________________________________________________________________ ERROR at teardown of TestClass.test_fixture _________________________________________________________________________
yield_fixture function has more than one 'yield':
【问题讨论】: