nosetests smashing module content

September 18, 2008 – 12:24

Work Time FunImage via Wikipedia Spent several hours yesterday untangling yet another mysterious test crash:

Warning: Field 'id' doesn't have a default value

As appears, it happened during usual INSERT to djangocontenttype… WTF!?

mysql> describe django_content_type;
+-----------+--------------+------+-----+---------+-------+
| Field     | Type         | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| id        | int(11)      | NO   | PRI | NULL    |       |
| name      | varchar(100) | NO   |     | NULL    |       |
| app_label | varchar(100) | NO   | MUL | NULL    |       |
| model     | varchar(100) | NO   |     | NULL    |       |
+-----------+--------------+------+-----+---------+-------+
4 rows in set (0.01 sec)

Where the #$^ AUTOINCREMENT is?

To make long story short, it appeared that for some strange reason django.db.connection.creation.data__types contains the values for sqlite that we use in previous tests and not mysql backend that is reported to be used.

And, yes, isolation plugin of nosetests doesn’t help.

Reblog this post [with Zemanta]