0

When i run my app test django don't create my app tables and throw an error.

My test file:

from django.test import TestCase

class MyTest(TestCase):
  fixtures = ['initial_data.json']

  def test_my_stuff(self):
    [...]

When i run test:

DatabaseError: Problem installing fixture '/home/.../djStock/stock/fixtures/initial_data.json': Could not load stock.Provider(pk=1): (1146, "Table 'test_djstock.stock_provider' doesn't exist")

My app is correctly added in INSTALLED_APPS. What i miss ?

bux
  • 7,087
  • 11
  • 45
  • 86

2 Answers2

0

Must be have south migration files. Check if myapp/migration/ contain files for migration.

bux
  • 7,087
  • 11
  • 45
  • 86
0

You have to comment out 'south' in INSTALLED_APPS before running any tests, otherwise if models are updated, you Django won't have the update reflected in the table creation, thus you get the error that table does not exist.

Assuming you are using Django 1.6.