Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify which tests to run with "python setup.py nosetests"

Tags:

python

nose

Behold, my setup.py:

https://github.com/mongodb/motor/blob/master/setup.py

... and setup.cfg:

https://github.com/mongodb/motor/blob/master/setup.cfg

I'd like to be able to run one suite, like:

python setup.py nosetests test.test_motor_ssl

But I get "invalid command name 'test.test_motor_ssl'". With this, on the other hand:

python setup.py nosetests --tests test.test_motor_ssl

... nosetests runs every test in my project. How can I tell nosetests, when it is running in setup.py, how to run a subset of tests?

like image 769
A. Jesse Jiryu Davis Avatar asked Mar 05 '13 03:03

A. Jesse Jiryu Davis


People also ask

How do I test a setup py file?

If you really want isolation instead just doing python setup.py install in virtualenv. Then use virtualbox and install some free linux os in it. Take a snapshot of the machine after the install so you can revert easily with one click to the starting point at any time and try python setup.py install there.

Which command is used to run nose tests?

nose can be integrated with DocTest by using with-doctest option in athe bove command line. The result will be true if the test run is successful, or false if it fails or raises an uncaught exception. nose supports fixtures (setup and teardown methods) at the package, module, class, and test level.


2 Answers

Apparently this is a known bug in nose 1.2.1 and they already have a fix in the master branch. You can either wait for the next version or use the nosetests command directly.

source: https://github.com/nose-devs/nose/issues/556

like image 71
user2411718 Avatar answered Oct 05 '22 17:10

user2411718


The only thing that works now is actually the directory approach. It is still not possible to specify the path...

python setup.py nosetests -w tests/test_folder
like image 35
Rmatt Avatar answered Oct 05 '22 16:10

Rmatt