Fixed #20548 -- Removed all PendingDeprecationWarnings from django test suite

This commit is contained in:
Marc Tamlyn 2013-06-14 15:02:30 +01:00
parent 5459795ef2
commit 46789e76c6
7 changed files with 29 additions and 16 deletions

View file

@ -10,8 +10,8 @@ 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.simple import DjangoTestSuiteRunner, get_tests
from django.test.testcases import connections_support_transactions
from django.test.utils import IgnorePendingDeprecationWarningsMixin
from django.utils import unittest
from django.utils.importlib import import_module
@ -225,15 +225,17 @@ class Ticket17477RegressionTests(AdminScriptTestCase):
self.assertNoOutput(err)
class ModulesTestsPackages(unittest.TestCase):
class ModulesTestsPackages(IgnorePendingDeprecationWarningsMixin, unittest.TestCase):
def test_get_tests(self):
"Check that the get_tests helper function can find tests in a directory"
from django.test.simple import get_tests
module = import_module(TEST_APP_OK)
tests = get_tests(module)
self.assertIsInstance(tests, type(module))
def test_import_error(self):
"Test for #12658 - Tests with ImportError's shouldn't fail silently"
from django.test.simple import get_tests
module = import_module(TEST_APP_ERROR)
self.assertRaises(ImportError, get_tests, module)
@ -258,7 +260,7 @@ class Sqlite3InMemoryTestDbs(unittest.TestCase):
},
})
other = db.connections['other']
DjangoTestSuiteRunner(verbosity=0).setup_databases()
runner.DiscoverRunner(verbosity=0).setup_databases()
msg = "DATABASES setting '%s' option set to sqlite3's ':memory:' value shouldn't interfere with transaction support detection." % option
# Transaction support should be properly initialised for the 'other' DB
self.assertTrue(other.features.supports_transactions, msg)
@ -273,12 +275,12 @@ class DummyBackendTest(unittest.TestCase):
"""
Test that setup_databases() doesn't fail with dummy database backend.
"""
runner = DjangoTestSuiteRunner(verbosity=0)
runner_instance = runner.DiscoverRunner(verbosity=0)
old_db_connections = db.connections
try:
db.connections = db.ConnectionHandler({})
old_config = runner.setup_databases()
runner.teardown_databases(old_config)
old_config = runner_instance.setup_databases()
runner_instance.teardown_databases(old_config)
except Exception as e:
self.fail("setup_databases/teardown_databases unexpectedly raised "
"an error: %s" % e)