Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass command line arguments to nose via "python setup.py test"

Package Settings

I have built a Python package which uses nose for testing. Therefore, setup.py contains:

..
test_suite='nose.collector',
tests_require=['nose'],
..

And python setup.py test works as expected:

running test
...
----------------------------------------------------------------------
Ran 3 tests in 0.065s

OK

Running with XUnit output

Since I'm using Jenkins CI, I would like to output the nose results to JUnit XML format:

nosetests <package-name> --with-xunit --verbose

However, python setup.py test is far more elegant, and it installs the test requirements without having to build a virtual environment.

Is there a way to pass the --with-xunit (or any other parameter) to nose, when calling nose via python setup.py test?

like image 436
Adam Matan Avatar asked May 21 '26 14:05

Adam Matan


1 Answers

You can set nosetests option using setup.cfg

For example in you setup.cfg

[nosetests]
with-xunit=1

Further information can be found at http://nose.readthedocs.io/en/latest/api/commands.html

like image 62
TomDotTom Avatar answered May 24 '26 05:05

TomDotTom



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!