【发布时间】:2016-07-18 07:13:17
【问题描述】:
我在两种模式下运行测试:使用裸 pytest 和使用 pytest-xdist。 我有一个用模块范围定义的重型夹具。在这个夹具中,我对使用 xdist 运行测试时的情况进行了一些优化:
@pytest.fixture(scope="module")
def myfixture(request):
if running_with_pytest:
pass
else:
pass
它工作正常,但我也想将夹具的范围更改为session(如果我使用 xdist 运行测试)。
我该怎么做?
【问题讨论】:
-
您好,您是否找到了解决此问题的方法。我也面临同样的问题