How do you load test fixtures using the django-nose test runner?
A:
#settings.test.py
INSTALLED_APPS += ('django_nose', )
TEST_RUNNER = 'django_nose.run_tests'
#appname/tests.py
from datetime import date,datetime, timedelta
from django.contrib.auth.models import User
from django.test.client import Client
from django.test import TestCase
class BetViewsTestCase(TestCase):
#files placed in appname/fixtures/restaurant.json, appname/fixtures/map.json
fixtures = ['authtestdata.json', 'restaurant.json', 'map.json']
iddqd
2010-09-24 08:33:30
Is it not possible to load test cases without the boilerplate django.test.TestCase subclass?
epoch
2010-09-24 08:40:34
1) create shell script: first load fixtures: django-admin.py loaddata foo/bar/mydata.json; run test logic; end; 2)you can load fixtures from python: from django.core import management management.call_command('loaddata', 'fixture1.json', verbosity=0)
iddqd
2010-09-24 08:43:09