On Mon, Aug 17, 2009 at 11:10 AM, Marek Wawrzyczek <mwawrzyc...@gmail.com>wrote:
> > Hi, > > > I've got an application called myapp > > In the main folder of django project there is initial_data.json file > containing initial data for the application > I also have file "simplefix.json" situated in myapp/fixtures > containing initial data for tests > > Then after calling: python manage.py test myapp: > > the following output is shown: > > (...creating tables and indexes....) > > Installing json fixture 'initial_data' from absolute path. > Installed 114 object(s) from 1 fixture(s) > hello > > myapp/tests.py has the following content: > > > from django.test import TestCase > > class SimpleTestCase(TestCase): > > fixtures = ['simplefix.json'] > > def testOne(self): > print 'hello' > > > How can I load database during tests from defined fixture? I tried > putting simplefix.json in myapp/ in main project folder, in fixtures > directory in main project folder and none of that worked > What you have shown (with simplefix.json in your app's fixtures directory) should be working. How are you determining that it isn't? Note there is no feedback printed for non-initial-data fixtures loaded during testing, so you won't see a message for simplefix.json as you do for the initial data fixture. If you are determining that it isn't working because your test code can't access data that should have been loaded, then I'd suspect a typo in the file name somewhere. Unfortunately there is also no feedback for this case, so double check that you've got the file with the right name, and specified the right name in the TestCase fixtures attribute. Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---