Changed test_runner imports to name objects imported from test.runner.

This commit is contained in:
wrwrwr 2014-11-15 20:03:31 +01:00 committed by Tim Graham
parent 1dbdc03382
commit 31f85bae1e
1 changed files with 13 additions and 12 deletions

View File

@ -10,7 +10,8 @@ from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django.db.backends.dummy.base import DatabaseCreation
from django.test import runner, TestCase, TransactionTestCase, skipUnlessDBFeature
from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature
from django.test.runner import DiscoverRunner, dependency_ordered
from django.test.testcases import connections_support_transactions
from django.utils import six
@ -31,7 +32,7 @@ class DependencyOrderingTests(unittest.TestCase):
'bravo': ['charlie'],
}
ordered = runner.dependency_ordered(raw, dependencies=dependencies)
ordered = dependency_ordered(raw, dependencies=dependencies)
ordered_sigs = [sig for sig, value in ordered]
self.assertIn('s1', ordered_sigs)
@ -51,7 +52,7 @@ class DependencyOrderingTests(unittest.TestCase):
'bravo': ['charlie'],
}
ordered = runner.dependency_ordered(raw, dependencies=dependencies)
ordered = dependency_ordered(raw, dependencies=dependencies)
ordered_sigs = [sig for sig, value in ordered]
self.assertIn('s1', ordered_sigs)
@ -78,7 +79,7 @@ class DependencyOrderingTests(unittest.TestCase):
'delta': ['charlie'],
}
ordered = runner.dependency_ordered(raw, dependencies=dependencies)
ordered = dependency_ordered(raw, dependencies=dependencies)
ordered_sigs = [sig for sig, aliases in ordered]
self.assertIn('s1', ordered_sigs)
@ -105,7 +106,7 @@ class DependencyOrderingTests(unittest.TestCase):
'alpha': ['bravo'],
}
self.assertRaises(ImproperlyConfigured, runner.dependency_ordered, raw, dependencies=dependencies)
self.assertRaises(ImproperlyConfigured, dependency_ordered, raw, dependencies=dependencies)
def test_own_alias_dependency(self):
raw = [
@ -116,7 +117,7 @@ class DependencyOrderingTests(unittest.TestCase):
}
with self.assertRaises(ImproperlyConfigured):
runner.dependency_ordered(raw, dependencies=dependencies)
dependency_ordered(raw, dependencies=dependencies)
# reordering aliases shouldn't matter
raw = [
@ -124,7 +125,7 @@ class DependencyOrderingTests(unittest.TestCase):
]
with self.assertRaises(ImproperlyConfigured):
runner.dependency_ordered(raw, dependencies=dependencies)
dependency_ordered(raw, dependencies=dependencies)
class MockTestRunner(object):
@ -151,7 +152,7 @@ class ManageCommandTests(unittest.TestCase):
testrunner='test_runner.NonExistentRunner')
class CustomOptionsTestRunner(runner.DiscoverRunner):
class CustomOptionsTestRunner(DiscoverRunner):
def __init__(self, verbosity=1, interactive=True, failfast=True, option_a=None, option_b=None, option_c=None, **kwargs):
super(CustomOptionsTestRunner, self).__init__(verbosity=verbosity, interactive=interactive,
@ -244,7 +245,7 @@ class Sqlite3InMemoryTestDbs(TestCase):
},
})
other = db.connections['other']
runner.DiscoverRunner(verbosity=0).setup_databases()
DiscoverRunner(verbosity=0).setup_databases()
msg = "DATABASES setting '%s' option set to sqlite3's ':memory:' value shouldn't interfere with transaction support detection." % option_key
# Transaction support should be properly initialized for the 'other' DB
self.assertTrue(other.features.supports_transactions, msg)
@ -259,7 +260,7 @@ class DummyBackendTest(unittest.TestCase):
"""
Test that setup_databases() doesn't fail with dummy database backend.
"""
runner_instance = runner.DiscoverRunner(verbosity=0)
runner_instance = DiscoverRunner(verbosity=0)
old_db_connections = db.connections
try:
db.connections = db.ConnectionHandler({})
@ -277,7 +278,7 @@ class AliasedDefaultTestSetupTest(unittest.TestCase):
"""
Test that setup_datebases() doesn't fail when 'default' is aliased
"""
runner_instance = runner.DiscoverRunner(verbosity=0)
runner_instance = DiscoverRunner(verbosity=0)
old_db_connections = db.connections
try:
db.connections = db.ConnectionHandler({
@ -303,7 +304,7 @@ class SetupDatabasesTests(unittest.TestCase):
self._old_db_connections = db.connections
self._old_destroy_test_db = DatabaseCreation.destroy_test_db
self._old_create_test_db = DatabaseCreation.create_test_db
self.runner_instance = runner.DiscoverRunner(verbosity=0)
self.runner_instance = DiscoverRunner(verbosity=0)
def tearDown(self):
DatabaseCreation.create_test_db = self._old_create_test_db