Django

Code

Show
Ignore:
Timestamp:
06/30/08 07:18:29 (2 months ago)
Author:
russellm
Message:

Fixed #7572 -- Force the closure of the database connection at the end of fixture loading as a workaround for MySQL bug #37735. Thanks to Simon Litchfield for his help in narrowing down this issue.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/fixtures_regress/models.py

    r7789 r7803  
    4545    data = models.CharField(max_length=10) 
    4646 
     47# Models to regresison check #7572 
     48class Channel(models.Model): 
     49    name = models.CharField(max_length=255) 
     50 
     51class Article(models.Model): 
     52    title = models.CharField(max_length=255) 
     53    channels = models.ManyToManyField(Channel) 
     54     
     55    class Meta: 
     56        ordering = ('id',) 
    4757 
    4858__test__ = {'API_TESTS':""" 
     
    108118>>> management.call_command('loaddata', 'model-inheritance.json', verbosity=0) 
    109119 
     120############################################### 
     121# Test for ticket #7572 -- MySQL has a problem if the same connection is  
     122# used to create tables, load data, and then query over that data. 
     123# To compensate, we close the connection after running loaddata. 
     124# This ensures that a new connection is opened when test queries are issued. 
     125 
     126>>> management.call_command('loaddata', 'big-fixture.json', verbosity=0) 
     127 
     128>>> articles = Article.objects.exclude(id=9) 
     129>>> articles.values_list('id', flat=True) 
     130[1, 2, 3, 4, 5, 6, 7, 8] 
     131 
     132# Just for good measure, run the same query again. Under the influence of 
     133# ticket #7572, this will give a different result to the previous call. 
     134>>> articles.values_list('id', flat=True) 
     135[1, 2, 3, 4, 5, 6, 7, 8] 
     136 
    110137"""}