Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#13697 closed (fixed)

multiple_database test fails under Python 2.6

Reported by: Russell Keith-Magee 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: no UI/UX: no

Description

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/tests.py", 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 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

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 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

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

comment:3 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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