Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#13360 closed (fixed)

r12992 breaks Python2.3 compitibility in tests on 1.1.X branch

Reported by: Karen Tracey Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django's itercompat version of sorted can't handle what's being asked in the most recent (r12992) test changes made for PyPy support, causing failures in the aggregation and aggregation_regress tests when run under Python 2.3:

Installed 48 object(s) from 2 fixture(s)
test_aggregates_in_where_clause (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_aggregates_in_where_clause_pre_eval (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_annotate_with_extra (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
Doctest: modeltests.aggregation.models.__test__.API_TESTS ... FAIL
Doctest: regressiontests.aggregation_regress.models.__test__.API_TESTS ... FAIL

======================================================================
FAIL: Doctest: modeltests.aggregation.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\u\kmt\django\branch1.1.X\django\test\_doctest.py", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for modeltests.aggregation.models.__test__.API_TESTS
  File "C:\u\kmt\django\branch1.1.X\tests\modeltests\aggregation\models.py", line unknown line number, in API_TESTS

----------------------------------------------------------------------
File "C:\u\kmt\django\branch1.1.X\tests\modeltests\aggregation\models.py", line ?, in modeltests.aggregation.models.__test__.API_TESTS
Failed example:
    [sorted(o.iteritems()) for o in Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values()]
Exception raised:
    Traceback (most recent call last):
      File "C:\u\kmt\django\branch1.1.X\django\test\_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest modeltests.aggregation.models.__test__.API_TESTS[33]>", line 1, in ?
        [sorted(o.iteritems()) for o in Book.objects.filter(pk=1).annotate(mean_age=Avg('authors__age')).values()]
      File "C:\u\kmt\django\branch1.1.X\django\utils\itercompat.py", line 75, in sorted
        out_value = in_value[:]
    TypeError: unsubscriptable object
----------------------------------------------------------------------
File "C:\u\kmt\django\branch1.1.X\tests\modeltests\aggregation\models.py", line ?, in modeltests.aggregation.models.__test__.API_TESTS
Failed example:
    [sorted(o.iteritems()) for o in Book.objects.filter(pk=1).values().annotate(mean_age=Avg('authors__age'))]
Exception raised:
    Traceback (most recent call last):
      File "C:\u\kmt\django\branch1.1.X\django\test\_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest modeltests.aggregation.models.__test__.API_TESTS[36]>", line 1, in ?
        [sorted(o.iteritems()) for o in Book.objects.filter(pk=1).values().annotate(mean_age=Avg('authors__age'))]
      File "C:\u\kmt\django\branch1.1.X\django\utils\itercompat.py", line 75, in sorted
        out_value = in_value[:]
    TypeError: unsubscriptable object


======================================================================
FAIL: Doctest: regressiontests.aggregation_regress.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\u\kmt\django\branch1.1.X\django\test\_doctest.py", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for regressiontests.aggregation_regress.models.__test__.API_TESTS
  File "C:\u\kmt\django\branch1.1.X\tests\regressiontests\aggregation_regress\models.py", line unknown line number, in API_TESTS

----------------------------------------------------------------------
File "C:\u\kmt\django\branch1.1.X\tests\regressiontests\aggregation_regress\models.py", line ?, in regressiontests.aggre
gation_regress.models.__test__.API_TESTS
Failed example:
    sorted(Book.objects.select_related('publisher').annotate(num_authors=Count('authors')).values()[0].iteritems())
Exception raised:
    Traceback (most recent call last):
      File "C:\u\kmt\django\branch1.1.X\django\test\_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest regressiontests.aggregation_regress.models.__test__.API_TESTS[27]>", line 1, in ?
        sorted(Book.objects.select_related('publisher').annotate(num_authors=Count('authors')).values()[0].iteritems())
      File "C:\u\kmt\django\branch1.1.X\django\utils\itercompat.py", line 75, in sorted
        out_value = in_value[:]
    TypeError: unsubscriptable object


----------------------------------------------------------------------
Ran 5 tests in 2.203s

FAILED (failures=2)
Destroying test database...

Change History (2)

comment:1 by Karen Tracey, 14 years ago

Resolution: fixed
Status: newclosed

r12294: [1.1.X] Fixed #13360: For Python2.3 compatbility, don't pass iterators to sorted.

comment:2 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top