-
Notifications
You must be signed in to change notification settings - Fork 247
Closed
Labels
Description
Hi, I have the following script called test_cli.py
import sys
def test_one():
print(sys.argv[1])
def test_two():
print(sys.argv[1])When I run it like this
pytest -s
I can see the output -s (Which is fine because it is the second parameter of the CLI) but when I run it with pytest xdist as
pytest -s -n auto
I get the following output
================================== FAILURES ===================================
__________________________________ test_one ___________________________________
[gw0] win32 -- Python 3.6.4 c:\python36-32\python.exe
def test_one():
> print(sys.argv[1])
E IndexError: list index out of range
test_cli.py:3: IndexError
__________________________________ test_two ___________________________________
[gw1] win32 -- Python 3.6.4 c:\python36-32\python.exe
def test_two():
> print(sys.argv[1])
E IndexError: list index out of range
test_cli.py:5: IndexError
========================== 2 failed in 3.49 seconds ===========================
How can I access the CLI parameters when running with pytest-xdist ?
I need to use one of the parameters of the CLI to control the behaviour of one of my fixtures that is shared between tests and processes..
Thanks,
David