Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#15170 closed (fixed)

inspectdb test fails under MySQL MyISAM

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

Description

As of r15325, the inspectdb test fails under MySQL MyISAM. It passes under InnoDB.

======================================================================
FAIL: test_attribute_name_not_python_keyword (regressiontests.inspectdb.tests.InspectDBTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/rkm/projects/django/hg/tests/regressiontests/inspectdb/tests.py", line 13, in test_attribute_name_not_python_keyword
    self.assertIn("from_field = models.ForeignKey(InspectdbPeople)", out.getvalue())
AssertionError: 'from_field = models.ForeignKey(InspectdbPeople)' not found in u"# This is an auto-generated Django model ...

----------------------------------------------------------------------
Ran 1 test in 0.188s

FAILED (failures=1)

Note - I've truncated the output because it runs to thousands of characters on one line.

The problem is that MySQL's introspection backend doesn't identify foreign keys -- it identifies them as integer fields. As a result, the test fails because the field 'from' is identified as 'from_id', which isn't a colliding name.

Given that this is a limitation of MyISAM, we probably just need to skip the test -- which means we need a new live capability check in the features backend (can_introspect_foreign_key, or simliar). Unless, of course, someone can find a nifty way to fix the introspection.

Change History (3)

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

In [15385]:

Fixed #15170 -- Skip the inspectdb test under MySQL/MyISAM, because it can't differentiate a foreign key from an integer.

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