Running a specific test case in Django when your app has a tests directory

Check out django-nose. This allows you to specify tests to run like:

python manage.py test another.test:TestCase.test_method

or as noted in comments, use the syntax:

python manage.py test another.test.TestCase.test_method

Since Django 1.6 you can run a complete test case, or single test, using the complete dot notation for the element you want to run.

Automatic test discovery will now find tests in any file that starts with test under the working directory, so addressing the question you would have to rename your files, but you can now keep them inside the directory you want. If you want to use custom file names you can specify a pattern (default Django test runner) with the option flag --pattern="my_pattern_*.py".

So if you are in your manage.py directory and want to run the test test_a inside TestCase subclass A inside a file tests.py under the app/module example you would do:

python manage.py test example.tests.A.test_a

If you don't want to include a dependency and are in Django 1.6 or later that's how you do it.

See the Django documentation for more information