如何在py.test中使用多个核心?

时间:2015-10-08 15:57:03

标签: python pytest

查看py.test documentation,似乎传递-n NUM将指定要使用的核心数。

我的经验如下:

usage: py.test [options] [file_or_dir] [file_or_dir] [...]
py.test: error: unrecognized arguments: -n

如果我尝试在pytest.ini中指定它(这是我的偏好),我会得到相同的结果。

我正在将addopts = -n4添加到ini文件中,这似乎是文档所需要的。

我正在使用py.test 2.8,我已经尝试过python 2和python 3。

1 个答案:

答案 0 :(得分:10)

您需要安装xdist

pip install pytest-xdist
相关问题