Code

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#13360 closed (fixed)

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

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

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...

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to fixed
  • Status changed from new to closed

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

comment:2 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.