Search code examples
djangounit-testingtddnosetests

Django load test fixtures with django-nose


How do you load test fixtures using the django-nose test runner?


Solution

  • #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']