def setUpTestData(cls): ef = EasyFixture(FIXTURE_DICT) ef.save() # ef.save_file() return TestCase.setUpTestData()
# -*- coding:utf-8 -*- import django from django.conf import settings from django.test.utils import get_runner from django.test import TestCase """ TestCase.setUpTestData() is sometimes helpful. (worst case) """ settings.configure( DEBUG=True, DATABASES={"default": { "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:" }}, INSTALLED_APPS=[ 'django.contrib.auth', 'django.contrib.contenttypes', __name__, ], ) django.setup() class Tests(TestCase): def setUp(self): from django.contrib.auth.models import User for i in range(100):
# -*- coding:utf-8 -*- import django from django.conf import settings from django.test.utils import get_runner from django.test import TestCase """ TestCase.setUpTestData() is sometimes helpful. """ settings.configure( DEBUG=True, DATABASES={"default": { "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:" }}, INSTALLED_APPS=[ 'django.contrib.auth', 'django.contrib.contenttypes', __name__, ] ) django.setup() class Tests(TestCase): @classmethod def setUpTestData(cls): from django.contrib.auth.models import User