views:

33

answers:

1

When running a Django unit test, it try's to install a fixture (initial_data.json) to the db, but fails everytime due to Runtime Error: maximum recursion depth exceeded while calling Python object

Any idea what's going on?

Edit: Django 1.2.3 and Python 2.7

alt text

A: 

I frequently get frustratingly opaque errors from manage.py loaddata and related operations like the one you've illustrated here.

One possible cause is: fixtures generated from manage.py dumpdata > fixture.json -- sans any qualifying app names -- are full of extraneous records which you may not need for your tests.

You may wish to regenerate your initial_data.json file, excluding some or all of the following:

  • Admin log entries
  • Content-types (these automatically repopulate when manage.py syncdb and the like are invoked)
  • Sessions
  • django.contrib.auth permissions
  • Any models, or entire apps, that are specifically ancilliary to your tests (e.g. I generally omit django-tagging data, the tables for which can grow large very quickly, and whose content is often orthogonal to my tests)

If you need everything in your fixture, you can also try breaking it into two or more fixture files.

fish2000