Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#13697 closed (fixed)

multiple_database test fails under Python 2.6

Reported by: russellm Owned by: nobody
Component: Testing framework Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


When executed under Python 2.6, The multiple_database.QueriesTest.test_subquery test fails:

FAIL: Make sure as_sql works with subqueries and master/slave.
Traceback (most recent call last):
  File "/Users/rkm/projects/django/hg/tests/regressiontests/multiple_database/", line 886, in test_subquery
    self.assertRaises(ValueError, list, qs)
AssertionError: ValueError not raised

Ran 1 test in 0.008s

FAILED (failures=1)

Change History (3)

comment:1 Changed 6 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

The problem appears to (yet again) a weird inconsistency introduced by Python 2.6. Python 2.6 swallows all exceptions raised by len, and list() (which is used in this test case) calls len() early in the test process. As a result, the ValueError that is raised when _as_sql() is invoked on the subquery is never surfaced, and the test passes.

The fix is to correct the test case to use a method other than list() to force evaluation of the test case.

comment:2 Changed 6 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [13321]) Fixed #13697 -- Modified multiple_database test to avoid a failure observed under Python 2.6.

comment:3 Changed 5 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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