I have a Django project with production fixtures and testing fixtures. How to make testing fixtures loaded only while running tests?
Asked
Active
Viewed 339 times
1 Answers
1
You just need to put it into fixtures property of your testcase class. Like this:
class AnimalTestCase(TestCase):
fixtures = ['mammals.json', 'birds']
Docs can be found here

Aldarund
- 17,312
- 5
- 73
- 104
-
But when I `./manage.py runserver` mamals and birds are also loaded. How to escape that? – Sashko Lykhenko Dec 23 '14 at 11:14
-
Ups, looks like they aren't. Besides when I `flush` database, only `initial_data.json` fixture is loaded. – Sashko Lykhenko Dec 23 '14 at 11:20
-
1Yes, only initital_data will be loaded automatically. You can still load mamals manually via management commend if you need it. – Aldarund Dec 23 '14 at 11:22