queries test fails under MySQL InnoDB
|Reported by:||russellm||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2-beta|
|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.
Change History (12)
comment:1 Changed 4 years ago by russellm
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:4 Changed 4 years ago by erikr
- Owner changed from nobody to erikr
- Status changed from new to assigned
comment:5 Changed 4 years ago by erikr
- Owner changed from erikr to nobody
- Status changed from assigned to new