ProgrammingError: (1146, "Table 'test_<DB>.<TABLE>' doesn't exist") when running unit test for Djang
Posted
by abigblackman
on Stack Overflow
See other posts from Stack Overflow
or by abigblackman
Published on 2010-04-15T11:20:30Z
Indexed on
2010/04/15
11:23 UTC
Read the original article
Hit count: 277
I'm running a unit test using the Django framework and get this error.
Running the actual code does not have this problem, running the unit tests creates a test database on the fly so I suspect the issue lies there.
The code that throws the error looks like this
member = Member.objects.get(email=email_address)
and the model looks like
class Member(models.Model):
member_id = models.IntegerField(primary_key=True)
created_on = models.DateTimeField(editable=False, default=datetime.datetime.utcnow())
flags = models.IntegerField(default=0)
email = models.CharField(max_length=150, blank=True)
phone = models.CharField(max_length=150, blank=True)
country_iso = models.CharField(max_length=6, blank=True)
location_id = models.IntegerField(null=True, blank=True)
facebook_uid = models.IntegerField(null=True, blank=True)
utc_offset = models.IntegerField(null=True, blank=True)
tokens = models.CharField(max_length=3000, blank=True)
class Meta:
db_table = u'member'
there's nothing too odd there i can see.
the user running the tests has the same permissions to the database server as the user that runs the website
where else can I look to see what's going wrong, why is this table not being created?
© Stack Overflow or respective owner