Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #12395 - fixed test suite flushing problems on Postgres, MySQL.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11900 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 3bd849062c57d297f3b6f7cb12e4644ce19c52f8 1 parent fed3081
@jacobian jacobian authored
Showing with 45 additions and 46 deletions.
  1. +45 −46 tests/regressiontests/fixtures_regress/models.py
View
91 tests/regressiontests/fixtures_regress/models.py
@@ -129,6 +129,49 @@ def __unicode__(self):
', '.join(s.name for s in self.stores.all())
)
+# ome models with pathological circular dependencies
+class Circle1(models.Model):
+ name = models.CharField(max_length=255)
+ def natural_key(self):
+ return self.name
+ natural_key.dependencies = ['fixtures_regress.circle2']
+
+class Circle2(models.Model):
+ name = models.CharField(max_length=255)
+ def natural_key(self):
+ return self.name
+ natural_key.dependencies = ['fixtures_regress.circle1']
+
+class Circle3(models.Model):
+ name = models.CharField(max_length=255)
+ def natural_key(self):
+ return self.name
+ natural_key.dependencies = ['fixtures_regress.circle3']
+
+class Circle4(models.Model):
+ name = models.CharField(max_length=255)
+ def natural_key(self):
+ return self.name
+ natural_key.dependencies = ['fixtures_regress.circle5']
+
+class Circle5(models.Model):
+ name = models.CharField(max_length=255)
+ def natural_key(self):
+ return self.name
+ natural_key.dependencies = ['fixtures_regress.circle6']
+
+class Circle6(models.Model):
+ name = models.CharField(max_length=255)
+ def natural_key(self):
+ return self.name
+ natural_key.dependencies = ['fixtures_regress.circle4']
+
+class ExternalDependency(models.Model):
+ name = models.CharField(max_length=255)
+ def natural_key(self):
+ return self.name
+ natural_key.dependencies = ['fixtures_regress.book']
+
__test__ = {'API_TESTS':"""
>>> from django.core import management
@@ -235,8 +278,7 @@ def __unicode__(self):
[{"pk": 1, "model": "fixtures_regress.animal", "fields": {"count": 3, "weight": 1.2, "name": "Lion", "latin_name": "Panthera leo"}}, {"pk": 2, "model": "fixtures_regress.animal", "fields": {"count": 2, "weight": 2.29..., "name": "Platypus", "latin_name": "Ornithorhynchus anatinus"}}, {"pk": 10, "model": "fixtures_regress.animal", "fields": {"count": 42, "weight": 1.2, "name": "Emu", "latin_name": "Dromaius novaehollandiae"}}]
###############################################
-# Regression for #11428 - Proxy models aren't included
-# when you run dumpdata over an entire app
+# Regression for #11428 - Proxy models aren't included when you dumpdata
# Flush out the database first
>>> management.call_command('reset', 'fixtures_regress', interactive=False, verbosity=0)
@@ -245,7 +287,7 @@ def __unicode__(self):
>>> Widget(name='grommet').save()
# Dump data for the entire app. The proxy class shouldn't be included
->>> management.call_command('dumpdata', 'fixtures_regress', format='json')
+>>> management.call_command('dumpdata', 'fixtures_regress.widget', 'fixtures_regress.widgetproxy', format='json')
[{"pk": 1, "model": "fixtures_regress.widget", "fields": {"name": "grommet"}}]
###############################################
@@ -258,49 +300,6 @@ def __unicode__(self):
# Now lets check the dependency sorting explicitly
-# First Some models with pathological circular dependencies
->>> class Circle1(models.Model):
-... name = models.CharField(max_length=255)
-... def natural_key(self):
-... return self.name
-... natural_key.dependencies = ['fixtures_regress.circle2']
-
->>> class Circle2(models.Model):
-... name = models.CharField(max_length=255)
-... def natural_key(self):
-... return self.name
-... natural_key.dependencies = ['fixtures_regress.circle1']
-
->>> class Circle3(models.Model):
-... name = models.CharField(max_length=255)
-... def natural_key(self):
-... return self.name
-... natural_key.dependencies = ['fixtures_regress.circle3']
-
->>> class Circle4(models.Model):
-... name = models.CharField(max_length=255)
-... def natural_key(self):
-... return self.name
-... natural_key.dependencies = ['fixtures_regress.circle5']
-
->>> class Circle5(models.Model):
-... name = models.CharField(max_length=255)
-... def natural_key(self):
-... return self.name
-... natural_key.dependencies = ['fixtures_regress.circle6']
-
->>> class Circle6(models.Model):
-... name = models.CharField(max_length=255)
-... def natural_key(self):
-... return self.name
-... natural_key.dependencies = ['fixtures_regress.circle4']
-
->>> class ExternalDependency(models.Model):
-... name = models.CharField(max_length=255)
-... def natural_key(self):
-... return self.name
-... natural_key.dependencies = ['fixtures_regress.book']
-
# It doesn't matter what order you mention the models
# Store *must* be serialized before then Person, and both
# must be serialized before Book.
Please sign in to comment.
Something went wrong with that request. Please try again.