Search code examples
pythondjangodjango-testing

Where does django get initial fixtures from on manage.py test?


I am trying to run ./manage.py test without fixtures. I've deleted all fixtures I found from the project and made ./manage.py flush. When I ./manage.py syncdb I can see that Installed 0 object(s) from 0 fixture(s).

But when I run single test file ./manage.py test hello.tests.tests_selenium_login which involves no fixtures directly it somehow finds fixtures and prints that Installed 84 object(s) from 2 fixture(s)

Where are these fixture supposed to be?

upd

Solved by recloning repo. But that is an overkill, I suppose. And does not answer the question.


Solution

  • Django looks for fixtures in the fixtures folder of each application by default, as well as where you specify in the FIXTURE_DIRS setting.

    What is happening in your case is that there is no initial_data fixture, which is the one that gets loaded when you run syncdb/migrate. The fixture to load must be specified in the fixtures attribute of the testcase you run in the second command.