Melinda Kriston
Melinda Kriston

Reputation: 29

Python3 xdist with addoption

I want to use the custom options with distributed and subprocess testing. I have 2 addoption --resources_dir and --output_dir.

Try to start it with :

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

The error message:

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

Without xdist (-n auto) when i run the tests in a single process, it is working.

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

If i start with the last command. Its work with single process. No errors.

=============================== 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  

Upvotes: 0

Views: 577

Answers (1)

Melinda Kriston
Melinda Kriston

Reputation: 29

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

There is not fix for this bug. I used environments.

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_*

Upvotes: 1

Related Questions