From c3df86661955f218de4788a57338bb23428f5525 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Fri, 14 Jun 2013 23:11:51 +0200 Subject: [PATCH] Fixed #20603 -- Made the test suite faster. By avoiding to run syncdb with the full set of test models. Thanks Anssi for the idea. --- tests/multiple_database/tests.py | 6 ++++++ tests/swappable_models/tests.py | 7 +++++++ tests/syncdb_signals/tests.py | 5 +++++ tests/test_runner/tests.py | 6 ++++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py index e72fb6a4f9..a0d937ce81 100644 --- a/tests/multiple_database/tests.py +++ b/tests/multiple_database/tests.py @@ -1943,6 +1943,12 @@ class SyncOnlyDefaultDatabaseRouter(object): class SyncDBTestCase(TestCase): + + available_apps = [ + 'multiple_database', + 'django.contrib.auth', + 'django.contrib.contenttypes' + ] multi_db = True def test_syncdb_to_other_database(self): diff --git a/tests/swappable_models/tests.py b/tests/swappable_models/tests.py index d3d61341d2..858061db23 100644 --- a/tests/swappable_models/tests.py +++ b/tests/swappable_models/tests.py @@ -13,6 +13,13 @@ from swappable_models.models import Article class SwappableModelTests(TestCase): + + available_apps = [ + 'swappable_models', + 'django.contrib.auth', + 'django.contrib.contenttypes', + ] + def setUp(self): # This test modifies the installed apps, so we need to make sure # we're not dealing with a cached app list. diff --git a/tests/syncdb_signals/tests.py b/tests/syncdb_signals/tests.py index d7327a9ff3..d70fb2c2c0 100644 --- a/tests/syncdb_signals/tests.py +++ b/tests/syncdb_signals/tests.py @@ -55,6 +55,11 @@ signals.pre_syncdb.connect(pre_syncdb_receiver, sender=models) class SyncdbSignalTests(TestCase): + + available_apps = [ + 'syncdb_signals', + ] + def test_pre_syncdb_call_time(self): self.assertEqual(pre_syncdb_receiver.call_counter, 1) diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index 03a3619c7e..0dc7a0155a 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -9,7 +9,7 @@ from optparse import make_option from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command from django import db -from django.test import runner, TransactionTestCase, skipUnlessDBFeature +from django.test import runner, TestCase, TransactionTestCase, skipUnlessDBFeature from django.test.testcases import connections_support_transactions from django.test.utils import IgnorePendingDeprecationWarningsMixin from django.utils import unittest @@ -240,7 +240,9 @@ class ModulesTestsPackages(IgnorePendingDeprecationWarningsMixin, unittest.TestC self.assertRaises(ImportError, get_tests, module) -class Sqlite3InMemoryTestDbs(unittest.TestCase): +class Sqlite3InMemoryTestDbs(TestCase): + + available_apps = [] @unittest.skipUnless(all(db.connections[conn].vendor == 'sqlite' for conn in db.connections), "This is a sqlite-specific issue")