Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#15170 closed (fixed)

inspectdb test fails under MySQL MyISAM

Reported by: russellm 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: UI/UX:

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.

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by russellm

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

comment:2 Changed 3 years ago by russellm

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

In [15385]:

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

comment:3 Changed 3 years ago by jacob

  • milestone 1.3 deleted

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