Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a single test or single TestCase with django-nose?

With Django's normal test runner, you can drill down to run tests in a specific app, a specific subclass of TestCase, or a specific test within a specific subclass of TestCase.

E.g.:

./manage.py test myapp.MyTestCase.test_something 

However, django-nose doesn't appear to support anything beyond testing a specific app. How do I replicate the last two behaviors?

like image 228
GDorn Avatar asked Sep 16 '13 17:09

GDorn


2 Answers

Nose supports the following syntax (note : between test script name and test class name):

./manage.py test myapp.tests.test_script:MyTestCase.test_method 
like image 121
alecxe Avatar answered Sep 19 '22 23:09

alecxe


The correct answer is ./manage.py test myapp/tests/test_script:MyTestCase.test_method.

Using dots in the relative path did not work for me, but slashes did.

like image 42
Arun Gandikota Avatar answered Sep 23 '22 23:09

Arun Gandikota