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

2

37

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?

Anyways answered 16/9, 2013 at 17:48 Comment(0)
Z
83

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

./manage.py test myapp.tests.test_script:MyTestCase.test_method
Zaccaria answered 16/9, 2013 at 17:50 Comment(1)
It beast me why they wouldn't have used the Django standard of using a period... seems pretty backwards to me.Tyndale
S
7

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.

Syllabi answered 9/10, 2015 at 18:45 Comment(1)
Does not work for me: ImportError: Import by filename is not supported.Gyneco

© 2022 - 2024 — McMap. All rights reserved.