Opened 11 years ago
Last modified 11 years ago
#20963 closed Bug
order_by interaction with "brew" distribution of Python 2.7.5 introduces edge-case regression — at Initial Version
Reported by: | Preston Holmes | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.6-beta-1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This commit:
https://github.com/django/django/commit/69597e5bcc89aadafd1b76abf7efab30ee0b8b1a
introduced a change that interacts with the OS X specific "brew" installation of Python 2.7.5 to result in a regression in one test.
FAIL: test_tickets_2076_7256 (regressiontests.queries.tests.Queries1Tests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/admin/Desktop/django/tests/regressiontests/queries/tests.py", line 437, in test_tickets_2076_7256 ['<Item: one>', '<Item: two>', '<Item: one>', '<Item: two>', '<Item: four>'] File "/Users/admin/Desktop/django/django/test/testcases.py", line 776, in assertQuerysetEqual return self.assertEqual(list(items), values) AssertionError: Lists differ: [] != [u'<Item: one>', u'<Item: two>... Second list contains 5 additional elements. First extra element 0: <Item: one> - [] + [u'<Item: one>', + u'<Item: two>', + u'<Item: one>', + u'<Item: two>', + u'<Item: four>'] ---------------------------------------------------------------------- Ran 1 test in 0.033s FAILED (failures=1)
This is limited only to this patched distribution of Python. Unfortunately this is a rather common version to be running on developer machines.
This gist shows this error on a clean machine with the brew version of 2.7.5, and the python.org binary install version of 2.7.5
The crux of the issue can be seen in this PDB session started from the failing test:
(Pdb) Item.objects.filter(tags__isnull=False) [<Item: four>, <Item: one>, <Item: one>, <Item: two>, <Item: two>] (Pdb) Item.objects.filter(tags__isnull=False).order_by('tags') []