【发布时间】:2019-09-18 17:53:54
【问题描述】:
我正在尝试使用 xdist 和 2 个网关 (-n=2) 运行 2 个测试文件。每个测试文件都包含特定于用户权限的测试。在使用 pytest 和 pytest-xdist 运行测试时,我注意到一些测试随机失败。这是因为来自file1 的一些测试由另一个gw 执行。因此,如果 [gw0] 正在运行来自 file0 的大部分测试,则有时,[gw0] 也会执行来自 file1 的一些测试,从而导致失败。
我想知道是否有办法强制/要求xdist 执行特定文件,或者是否有办法将文件分配给gw?
pytest test_*.py -n=2 -s -v
也试过了:
pytest test_*.py -n=2 -s -v --dist=loadfile
【问题讨论】:
-
也许有办法将文件分配给 gw? - 这就是
--dist=loadfile所做的。
标签: pytest xdist parallel-execution