【发布时间】:2022-08-23 00:47:50
【问题描述】:
嗨,我正在尝试在 azure 管道上并行运行我的测试(pytest-xdist)。 到目前为止,测试运行得非常好。 突然,pytest 抛出一个奇怪的错误,说“无法识别的参数”。
文件名:integration_test.py 使用的命令:pytest -n 5 --tb=short integration_test.py -v -s --> 并行运行 5 个测试 测试总数:57 版本: pytest==6.2.5 pytest-xdist==2.3.0 甚至尝试使用这两个模块的最新版本。
错误 : 错误:用法:pytest [options] [file_or_dir] [file_or_dir] [...] pytest:错误:无法识别的参数:-n integration_test.py
我该如何克服这个错误?
-
您还没有安装
pytest-xdist,它添加了-n参数。 -
我已经安装了 pytest-xdist 模块。
-
仍然面临问题
-
那么你可能没有为正确的解释器安装它。运行
pytest -v --collect-only,插件中是否列出了xdist?最好将输出添加到问题中。
标签: pytest pytest-xdist