Hi everyone, We've been having this miscellaneous error with the default test runner in Django. We had a forms.py that was something like this:
class SomeForm(forms.ModelForm): some_field = some_custom_fields.SomeCustomField(choices=get_some_queryset_and_evaluate_it()) # Actually, we're using django-chosen's ChosenGroupChoiceField, so choices is a specially-constructed 4-D list of objects And our tests.py had: from forms import SomeForm Per the Django documentation, the tests are all imported before the test database and tables are created. This means our tests.py imports SomeForm, which in turn calls get_some_queryset_and_evaluate_it(), which in turn causes a DatabaseError: no such table: some_app_some_table, since the database hasn't been created yet. So, a few questions. 1. Should the test runner's behavior be changed? 2. Even if it should be, what's the best way to avoid this right now? We were thinking of either subclassing django.simple.test.DjangoTestSuiteRunner and altering it to create the database before importing tests (seems fragile), or simply modifying the choices in SomeForm's __init__ method (seems hacky). Thanks, Chris -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.