首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带addoption的Python3 xdist

带addoption的Python3 xdist
EN

Stack Overflow用户
提问于 2018-05-07 17:30:55
回答 1查看 427关注 0票数 0

我想在分布式和子流程测试中使用自定义选项。我有两个addoption --resources_dir和--output_dir。

试着以这样的方式开始:

python3 -m pytest -vs --junitxml=/tmp/result_alert_test.xml --resources_dir=test/resources --output_dir=/tmp/ -n auto test_*

错误消息:

代码语言:javascript
复制
Replacing crashed worker gw82
Cusage: -c [options] [file_or_dir] [file_or_dir] [...]
-c: error: the following arguments are required: --resources_dir, --output_dir
[gw83] node down: Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/execnet/gateway_base.py", line 1072, in executetask

当我在单个进程中运行测试时,如果没有xdist (-n auto),它就可以工作。

python3 -m pytest -vs --junitxml=/tmp/result_alert_test.xml --resources_dir=test/resources --output_dir=/tmp/ test_*

如果我从最后一个命令开始。它与单进程一起工作。没有错误。

代码语言:javascript
复制
=============================== test session starts ===============================
platform linux -- Python 3.5.2, pytest-3.5.0, py-1.5.3, pluggy-0.6.0 -- /usr/bin/python3
cachedir: ../../../../../.pytest_cache
rootdir: /, inifile:
plugins: xdist-1.22.2, forked-0.2
collected 115 items  
EN

回答 1

Stack Overflow用户

发布于 2018-05-08 00:14:12

https://github.com/pytest-dev/pytest/issues/2026

没有修复此错误的方法。我使用的是环境。

代码语言:javascript
复制
python3 -m pytest -vsx --full-trace --junitxml=${TEST_REPORT_DIR}/result_alert_test.xml --tx=popen//env:TEST_DIR=${TESTS_ROOT} --tx=popen//env:TEST_OUTPUT_DIR=${TEST_OUTPUT_DIR} -n auto -vs test_*
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50210996

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档