Opened 8 years ago

Closed 8 years ago

#5399 closed (duplicate)

Error in test suite, modeltests.fixtures.models.__test__.API_TESTS

Reported by: Ludovico Magnocavallo <ludo@…> Owned by: mir
Component: Testing framework 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

When running the test suite against [6094] using MySQL 5.0 on a pretty stock Ubuntu feisty system, I get an error in tests/modeltests/fixtures/models.py. The same error is not present if I switch the backend to sqlite3.

Here is the dump of the error messages

======================================================================
FAIL: Doctest: modeltests.fixtures.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "django/test/_doctest.py", line 2161, in runTest
AssertionError: Failed doctest test for modeltests.fixtures.models.__test__.API_TESTS
  File "/home/ludo/Desktop/dev/django-tests/modeltests/fixtures/models.py", line unknown line number, in API_TESTS

----------------------------------------------------------------------
File "/home/ludo/Desktop/dev/django-tests/modeltests/fixtures/models.py", line ?, in modeltests.fixtures.models.__test__.API_TESTS
Failed example:
    Article.objects.all()
Expected:
    [<Article: Time to reform copyright>, <Article: Poker has no place on ESPN>, <Article: Python program becomes self aware>]
Got:
    [<Article: XML identified as leading cause of cancer>, <Article: Time to reform copyright>, <Article: Poker on TV is great!>, <Article: Python program becomes self aware>]
----------------------------------------------------------------------
File "/home/ludo/Desktop/dev/django-tests/modeltests/fixtures/models.py", line ?, in modeltests.fixtures.models.__test__.API_TESTS
Failed example:
    management.call_command('dumpdata', 'fixtures', format='json')
Expected:
    [{"pk": "3", "model": "fixtures.article", "fields": {"headline": "Time to reform copyright", "pub_date": "2006-06-16 13:00:00"}}, {"pk": "2", "model": "fixtures.article", "fields": {"headline": "Poker has no place on ESPN", "pub_date": "2006-06-16 12:00:00"}}, {"pk": "1", "model": "fixtures.article", "fields": {"headline": "Python program becomes self aware", "pub_date": "2006-06-16 11:00:00"}}]
Got:
    [{"pk": "5", "model": "fixtures.article", "fields": {"headline": "XML identified as leading cause of cancer", "pub_date": "2006-06-16 16:00:00"}}, {"pk": "3", "model": "fixtures.article", "fields": {"headline": "Time to reform copyright", "pub_date": "2006-06-16 13:00:00"}}, {"pk": "2", "model": "fixtures.article", "fields": {"headline": "Poker on TV is great!", "pub_date": "2006-06-16 11:00:00"}}, {"pk": "1", "model": "fixtures.article", "fields": {"headline": "Python program becomes self aware", "pub_date": "2006-06-16 11:00:00"}}]


----------------------------------------------------------------------
Ran 160 tests in 124.687s

FAILED (failures=1)

Change History (3)

comment:1 Changed 8 years ago by mir@…

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to anonymous
  • Patch needs improvement unset
  • Status changed from new to assigned

This is a known limitation of the fixture framework: It does not (and cannot) work with MySQL. The fundamental problem is that MySQL does not check foreign key constraints at commit time, but at row insertion time (against SQL standards).

Anyway, it's bad when self tests break, I'm going to ask at the developers list for the policy.

comment:2 Changed 8 years ago by mir@…

  • Owner changed from anonymous to mir
  • Status changed from assigned to new

Learned that I have to log in to accept ticket

comment:3 Changed 8 years ago by russellm

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

This is a duplicate of #4788.

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