python-3.x - 带有附加选项的 Python3 xdist
问题描述
我想在分布式和子流程测试中使用自定义选项。我有 2 个附加选项 --resources_dir 和 --output_dir。
尝试从以下开始:
python3 -m pytest -vs --junitxml=/tmp/result_alert_test.xml --resources_dir=test/resources --output_dir=/tmp/ -n auto test_*
错误信息:
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_*
如果我从最后一个命令开始。它与单个进程一起工作。没有错误。
=============================== 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
解决方案
https://github.com/pytest-dev/pytest/issues/2026
没有修复此错误。我使用了环境。
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_*
推荐阅读
- wordpress - 无法删除“帖子首先出现”RSS
- flutter - 输入'未来
' 不是类型 'bool' shared_preferences 的子类型 - java - 如何从给定的一组日期中找到每个月的最少日期
- python - 在 groupby 对象上扩展均值
- laravel - 从具有特定键、值对的集合中获取项目并将其从 laravel 中的原始集合中删除的方法
- c++ - QGroupBox 如何支持 HTML?
- java - 如何将日期从 shell 脚本传递到 java Instant 数据类型
- reactjs - 当我调用 useState 挂钩时重新渲染 React 组件
- c - 在子字符串之后的字符串中查找多个字符
- javascript - 为 php 应用程序使用 X-frame 来限制点击劫持和隐藏目录列表