Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "pytest: error: unrecognized arguments: -n"

Hi I am trying to run my tests parallely(pytest-xdist) on the azure pipelines. Till now the tests were running perfectly fine. Suddenly the pytest is throwing a weird error saying "unrecognized argument".

The file name : integration_test.py Command used : pytest -n 5 --tb=short integration_test.py -v -s --> to run 5 tests parallely Total number of tests : 57 Versions : pytest==6.2.5 pytest-xdist==2.3.0 Even tried with the latest versions of these 2 modules.

Error : ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: unrecognized arguments: -n integration_test.py

How can I overcome this error?

like image 869
Dhanush Prabhakar Avatar asked Nov 22 '25 19:11

Dhanush Prabhakar


1 Answers

This error is what you encountered:

Error : ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: unrecognized arguments: -n integration_test.py  
  initfile: None
  rootdir: C:\test

enter image description here

As hoefling mentioned, the solution is to install the pytest-xdist:

pip install pytest-xdist

like image 159
Bowman Zhu Avatar answered Nov 26 '25 01:11

Bowman Zhu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!