(Pytest-Xdist)ModuleNotFoundError:没有名为“ execnet.rsync”的模块

时间:2020-07-20 13:15:14

标签: python pytest pyinstaller pytest-xdist

我一直试图将写在pytest上的测试捆绑为.exe文件。

我已经尝试了pytest文档中提到的包含第三方插件的代码: https://docs.pytest.org/en/latest/example/simple.html#freezing-pytest

我的代码如下:

import pytest
import xdist
import pytest_rerunfailures

if len(sys.argv) > 1 and sys.argv[1] == "--pytest":
    sys.exit(pytest.main(sys.argv[2:], plugins=[xdist, pytest_rerunfailures]))

有趣的是,该代码适用于pytest_rerunfailures,但是当我使用-n 2运行.exe时,它显示以下错误:

ERROR: usage: mainfile [options] [file_or_dir] [file_or_dir] [...]
mainfile: error: unrecognized arguments: -n
  inifile: None
  rootdir: A:\New folder (2)\Scripted\dist

mainfileexe文件的名称。

此外,值得一提的是,xdist命令行选项在正常运行测试时有效,但是当捆绑为exe时,会产生此问题。

ModuleNotFoundError: No module named 'execnet.rsync'

有人可以帮我吗?

0 个答案:

没有答案