I am trying to send parallel arguments by a programmatic invocation to pytest but doesn't seem to recognize them like when parallel is not installed at all, except that I know is there because when I run py.test with a direct command line invocation including the same arguments, it will find it and run successfully.
ERROR: usage: invoke_pytest.py [options] [file_or_dir] [file_or_dir] [...] invoke_pytest.py: error: unrecognized arguments: --workers 1 --tests-per-worker 4
This is my code:
import os
import sys
import pytest
pytest_args = [
"tests/bdd",
'--rootdir=tests/bdd',
"--workers 1",
"--tests-per-worker 4"
# ...
]
result = pytest.main(pytest_args)
print(f"RESULT {result}")
Although it seems unrelated, I am also using py.test bdd and splinter for this test suite.