queries test fails under MySQL InnoDB
|Reported by:||Russell Keith-Magee||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2-beta|
|Cc:||Erik Romijn||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
As of 1.2RC1, the queries test fails under MySQL InnoDB fails at the following test:
Failed example: Tag.objects.exclude(children=None) Expected: [<Tag: t1>, <Tag: t3>] Got: [<Tag: t1>, <Tag: t3>, <Tag: t4>]
This is at line 1150 (as of r13252).
This test passes as is under SQLite, Postgres, and MySQL MyISAM.
Even more weird - if you dig into the database at the time the test runs, the query is the same, and the contents of the table is the same. The issue appears to be entirely related to a query cache somewhere in the MySQLdb infrastructure, but only under InnoDB.
You can make the test pass by inserting:
just before the failing test. You can also make the test pass by manually issuing the same query twice, and only checking the test result on the second execution -- i.e., if you modify the test to the following:
>>> r = list(Tag.objects.exclude(children=None)) >>> Tag.objects.exclude(children=None) [<Tag: t1>, <Tag: t3>]
The test will pass.