Django load global fixtures test helper

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import os

from django.core import management
from django.conf import settings


def load_global_fixtures(*fixtures, **opts):
    options = dict(fixtures_root=settings.FIXTURES_ROOT, verbosity=0)
    options.update(opts)

    for fixture in fixtures:
        management.call_command('loaddata',
                os.path.join(options['fixtures_root'], fixture),
                verbosity=options['verbosity'])

More like this

  1. manage.py with magic python path by bikeshedder 5 years, 11 months ago
  2. Unit Tests That Write Fixtures by justquick 4 years, 3 months ago
  3. staticview for app by limodou 5 years, 11 months ago
  4. testdata tag for templates by showell 4 years ago
  5. Setting distinction between development and public server by Archatas 6 years, 2 months ago

Comments

(Forgotten your password?)