Running Specific Test in django-nose

Since I used django-nose for my project. Django-nose runner cannot behave like default django test runner.

Following command will not work in django-nose test runner.

# Run all the tests found within the 'animals' package
$ ./manage.py test appname

# Run just one test case
$ ./manage.py test appname.tests.TestCaseName

# Run just one test method
$ ./manage.py test appname.tests.TestCaseName.test_function_name

Because django-nose structured all the test in one package called tests following below.

tests:
   |- __init__.py
   |- test_views.py
   |- test_forms.py
   |- test_endpoints.py
   |- test_utils.py

Here is the alternative to run specific task in django-nose.

# Run all the tests found within the 'animals' package
$ ./manage.py test appname

# Run just one test case
$ ./manage.py test appname.tests.test_script:TestCaseName

# Run just one test method
$ ./manage.py test appname.tests.test_script:TestCaseName.test_function_name

Reference: https://stackoverflow.com/a/18834222/1936697

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s