Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run specific test in Nose2

In previous version of Nose testing framework, there were several ways to specify only a subset of all tests:

nosetests test.module
nosetests another.test:TestCase.test_method
nosetests a.test:TestCase
nosetests /path/to/test/file.py:test_function

http://nose.readthedocs.org/en/latest/usage.html#selecting-tests

However, I can't find any information about similar test selection in Nose2. There's a mention in docs about different test discovery, but that doesn't seem to be related.

Is there a way to select a specific test or test case in nose2 or (more generally) in unittest2?

like image 603
Tomáš Ehrlich Avatar asked Jul 26 '13 20:07

Tomáš Ehrlich


1 Answers

I have some tests in dev/tests, for example:

dev/tests/test_file.py

I am able to run this with:

nose2 -s dev tests.test_file

Additionally, I'm able to run a specific test method in a test case as follows:

nose2 -s dev tests.test_file.TestCase.test_method

Does that accomplish what you want?

like image 58
mmagin Avatar answered Sep 23 '22 13:09

mmagin