I know this question was asked before, but I was wanting to see if there is a more updated solution. Would there be a way to load all my fixtures in setUp
and and flush them when all tests are finished?
Right now, I'm loading in my fixtures like so...
from django.test import TestCase
from django.core.management import call_command
class GlobalSetup(TestCase):
def setUp(self):
# Load fixtures
call_command('loaddata', 'test_cfst.json', verbosity=0)
call_command('loaddata', 'test_lmt.json', verbosity=0)
call_command('loaddata', 'test_qt.json', verbosity=0)
class BaseTest(GlobalSetup):
fixtures = [
'test_cfst.json',
'test_lmt.json',
'test_qt.json'
]
def setUp(self):
super(BaseTest, self).setUp()
def test_base(self):
# Some random tests
With the newer version of django is there a way, or better way, to do this?