我有一个fixture,它返回一个特定类型的对象,我在另一个文件中定义了另一个fixture,它基本上使用这个对象来做其他事情。但是我不能从我的第一个固定装置返回物体。在
file-1
def fixture_1(s, **kwargs):
def hook(s, **kwargs):
p_b = s.get()
p = p_b.build()
yield p
return hook
file-2
conftest.py
我想基本上检索返回到file-1
fixture_1
中的对象p
,并在file-2
fixture_2
fixture中使用它。在
似乎您错误地使用了pytest fixtures(查看参数名称)
我强烈建议你通过https://docs.pytest.org/en/latest/fixture.html
对于您的问题,似乎有两种解决方案:
还有第二个变种
^{pr2}$相关问题 更多 >
编程相关推荐