6

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?

A. Jesse Jiryu Davis
  • 23,641
  • 4
  • 57
  • 70
  • Would one of these posts/links have what you are looking for? http://stackoverflow.com/questions/3704473/how-do-i-run-a-single-test-with-nose-in-pylons http://stackoverflow.com/questions/11210519/manually-adding-test-suite-to-nose/13996879#13996879 http://blog.cesarcd.com/2011/11/python-testing-with-nose-by-example.html Cheers – HRVHackers Apr 28 '13 at 22:12
  • No, because those posts/links don't answer the question in the way I asked it, specifically highlighted in bold: They don't tell me how to run one test suite when nose is running in setup.py. – A. Jesse Jiryu Davis Apr 29 '13 at 03:02

3 Answers3

3

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

3

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
Rmatt
  • 1,287
  • 1
  • 16
  • 30
3

Using nose==1.3.1 I'm able to run a single test class/test case via: python setup.py nosetests --tests tests/test_file.py:TestClass.test_case

cmcguire
  • 131
  • 2