Reputation: 1604
Is there a decorator in Django that would allow to run the test function without applying fixtures?
Something like:
from django.test import TestCase
class TestSomething(TestCase):
fixtures = ['test_fixture.json']
def test_with_fixture(self):
# test something with fixtures
@do_not_use_fixtures
def test_without_fixtures(self):
# test something without fixtures
Upvotes: 2
Views: 899
Reputation: 308789
Django's TestCase
loads the fixtures once for the class for performance reasons. Therefore it isn't possible to run a test method without fixtures.
It might be possible with TransactionTestCase
, but you'd have to dive into the Django internals to do this, so I wouldn't recommend it.
Upvotes: 2