Hi, I just tried out your project. Looking at the stacktrace, the test module is importing forms (before the test starts). The forms module is running a query on startup for choices.
https://github.com/merwan/django-choicefield/blob/master/myapp/forms.py Don't do queries on startup. :) Collin On Monday, January 26, 2015 at 7:07:54 AM UTC-5, Merouane Atig wrote: > > Hi, > > I have a strange issue with a forms test and I would like to know if I'm > doing something wrong or if it is a Django bug. > > I created a repo to reproduce the issue I have: > https://github.com/merwan/django-choicefield > > I have a DomainForm class with a choice field populated from a table in > the database. I'm trying to test it using the Django testing tools, but I > get the error "django.db.utils.OperationalError: no such table: > myapp_topleveldomain" (see the README in the Github repo for the full stack > trace). > > If I first create my development database and migrate it, then I do not > have any error. I expected that the test would run on the test database but > it is not the case. > > My test environment should work properly as I also created a model test > which runs correctly on the test database and do not need the development > database. > > Can you tell me what would be the proper way to write this test so that it > runs on the test database? Is it a bug with the Django testing tools or am > I doing something wrong when populating my ChoiceField? > > I'm using Django 1.7.3 and Python 3.4.0 > > Thanks for your help > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dc9f47cb-cd64-4607-afe1-12f86e492034%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

