Environment:
Django version: 1.7.1
Nose version: 1.3.4
django-nose version: 1.2
I have two apps:
dog and human
The model has:
class Dog(models.Model):
human = models.ForeignKey('humans.Human', null=False)
def askFood(human):
...
human
and in the model there is a function like in the example attributes of human, like
name = models.CharField(_('Name'), null=False, max_length=120)
The two apps are listed the INSTALLED_APPS in the settings file.
The FIXURE_DIRS is as follows:
FIXTURE_DIRS = (
os.path.join(os.path.dirname(__file__), '../**/tests'),
)
The tests are in the tests folder of the dog app.
I have a test in the dog app to test the askFood funcion, and I have a JSON fixture(initial_data) with a human.
[
{
"pk": 1,
"model": "human.Human",
"fields": {
"name": "Test"
}
},
]
The test is:
class DogFixtureTestCase(TestCase):
fixtures = ['./initial_data.json']
class TestFixtureDog(DogFixtureTestCase):
def test_ask_food(self):
...
I execute the command to test:
python manage.py test dog
There is an error:
no such table: dog_dog
Apparently it is not syncing all the apps, it is creating the tables only of the dog, when the fixture runs it cannot find the human table. How can I force the tests to create the model to all apps?
Thanks in advance for the help :)
[EDIT]
I changed the title and posted an answer to maybe help someone with the same problem.
The problem is not that the sync doesn't create all the tables, the error message that is misleading. The problem is with the initial data fixture that is not supported in the django 1.7 anymore.
Ok, I'm going to answer my question :)
I found a bug report in the bug tracker of django:
The problem is not loading the fixtures, but only the initial data.
So apparently there are three options: