Loading fixtures in django unit tests
Posted
by loder
on Stack Overflow
See other posts from Stack Overflow
or by loder
Published on 2010-03-18T14:39:27Z
Indexed on
2010/03/18
14:41 UTC
Read the original article
Hit count: 528
I'm trying to start writing unit tests for django and I'm having some questions about fixtures:
I made a fixture of my whole project db (not certain application) and I want to load it for each test, because it looks like loading only the fixture for certain app won't be enough.
I'd like to have the fixture stored in /proj_folder/fixtures/proj_fixture.json.
I've set the FIXTURE_DIRS = ('/fixtures/',)
in my settings.py.
Then in my testcase I'm trying
fixtures = ['proj_fixture.json']
but my fixtures don't load. How can this be solved? How to add the place for searching fixtures? In general, is it ok to load the fixture for the whole test_db for each test in each app (if it's quite small)? Thanks!
© Stack Overflow or respective owner