jeudi 26 mars 2015

Can't install auth.group fixture when testing - django 1.7

I have a django project and I am trying to write some tests for it. However, my initial_data fixtures cause an error when running the test.


The error that I am getting is:



django.db.utils.ProgrammingError: Problem installing fixture 'accounts/fixtures/initial_data.json': Could not load auth.Group(pk=1): relation "auth_group" does not exist
LINE 1: UPDATE "auth_group" SET "name" = '...


If I rename my fixture to something other than initial_data so that it doesn't get loaded by default, it works, but I don't want to rename my fixtures, because that would mean that I can no longer run loaddata without arguments.


I have found this bug, but my project does not have any initial migrations. Also, I have other fixtures which are loaded just fine.


So far, I have tried:



  • flushing my development database, as well as deleting any possible migration files

  • deleting and re-creating my virtual env

  • changing the order of my apps in INSTALLED_APPS

  • calling the flush command in the .setUp() method.


I should mention that I am using the APITestCase from django-rest-framework.


Any suggestions are welcomed. Thanks.


Aucun commentaire:

Enregistrer un commentaire