I'm aware of how to run a specific test class with django : python manage.py test MyApp.MyTestClass
.
What I'd like to do is the opposite : run every tests except one in particular.
To my mind, this would look like this : python manage.py test --ignore=MyApp.MyTestClass
Is there a simple way to do so ?
EDIT : An extra bonus would be to still be able to run the test manually (using the first command).
The test
command has no built-in ignore option.
But you could use the @skip
or @skipIf
decorator in the class you want to exlude: http://docs.python.org/2.7/library/unittest.html#unittest.skipIf
import unittest
@unittest.skip("skip the test")
class MyTestClass(TestCase):
...
Test command does not have ignore option by default. You can try django-ignoretests. You can install it using
pip install django-ignoretests
You can ignore apps by including them in IGNORE_TESTS
as given below:
IGNORE_TESTS = (
# Apps to ignore. example : 'django.contrib.auth',
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With