From 7b21bfc0745f92f83a6826a3d3e58797fb74e326 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Tue, 20 Sep 2011 18:16:49 +0000 Subject: Improved test isolation of the admin tests and assigned custom admin sites to prevent test order dependant failures. This involves introducing usage of `TestCase.urls` and implementing proper admin.py modules for some of the test apps. Thanks Florian Apolloner for finding the issue and contributing the patch. Refs #15294 (it solves these problems so the fix for that ticket we are going to commit doesn't introduce obscure and hard to reproduce test failures when running the Django test suite.) git-svn-id: http://code.djangoproject.com/svn/django/trunk@16856 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/generic_inline_admin/tests.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/regressiontests/generic_inline_admin/tests.py') diff --git a/tests/regressiontests/generic_inline_admin/tests.py b/tests/regressiontests/generic_inline_admin/tests.py index da59922fe5..858d6a5f3b 100644 --- a/tests/regressiontests/generic_inline_admin/tests.py +++ b/tests/regressiontests/generic_inline_admin/tests.py @@ -10,10 +10,12 @@ from django.test import TestCase # local test models from models import (Episode, EpisodeExtra, EpisodeMaxNum, Media, - MediaInline, EpisodePermanent, MediaPermanentInline, Category) + EpisodePermanent, Category) +from admin import MediaInline, MediaPermanentInline class GenericAdminViewTest(TestCase): + urls = "regressiontests.generic_inline_admin.urls" fixtures = ['users.xml'] def setUp(self): @@ -125,6 +127,7 @@ class GenericAdminViewTest(TestCase): self.assertTrue(formset.get_queryset().ordered) class GenericInlineAdminParametersTest(TestCase): + urls = "regressiontests.generic_inline_admin.urls" fixtures = ['users.xml'] def setUp(self): @@ -177,6 +180,7 @@ class GenericInlineAdminParametersTest(TestCase): class GenericInlineAdminWithUniqueTogetherTest(TestCase): + urls = "regressiontests.generic_inline_admin.urls" fixtures = ['users.xml'] def setUp(self): @@ -203,6 +207,8 @@ class GenericInlineAdminWithUniqueTogetherTest(TestCase): self.assertEqual(response.status_code, 302) # redirect somewhere class NoInlineDeletionTest(TestCase): + urls = "regressiontests.generic_inline_admin.urls" + def test_no_deletion(self): fake_site = object() inline = MediaPermanentInline(EpisodePermanent, fake_site) @@ -211,6 +217,7 @@ class NoInlineDeletionTest(TestCase): self.assertFalse(formset.can_delete) class GenericInlineModelAdminTest(TestCase): + urls = "regressiontests.generic_inline_admin.urls" def setUp(self): self.site = AdminSite() -- cgit v1.3