mirror of https://github.com/django/django.git
parent
4daf570b98
commit
c6e6d4eeb7
|
@ -5,7 +5,16 @@ from django.utils.module_loading import import_by_path
|
||||||
from django.utils.unittest import SkipTest
|
from django.utils.unittest import SkipTest
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
|
|
||||||
class AdminSeleniumWebDriverTestCase(LiveServerTestCase):
|
class AdminSeleniumWebDriverTestCase(LiveServerTestCase):
|
||||||
|
|
||||||
|
available_apps = [
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.sites',
|
||||||
|
]
|
||||||
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -8,10 +8,18 @@ from django.test import TransactionTestCase
|
||||||
from django.test.utils import override_settings
|
from django.test.utils import override_settings
|
||||||
|
|
||||||
|
|
||||||
|
# This must be a TransactionTestCase because the WSGI auth handler performs
|
||||||
|
# its own transaction management.
|
||||||
class ModWsgiHandlerTestCase(TransactionTestCase):
|
class ModWsgiHandlerTestCase(TransactionTestCase):
|
||||||
"""
|
"""
|
||||||
Tests for the mod_wsgi authentication handler
|
Tests for the mod_wsgi authentication handler
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
available_apps = [
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
]
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
def test_check_password(self):
|
def test_check_password(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1474,6 +1474,13 @@ class ArgumentOrder(AdminScriptTestCase):
|
||||||
|
|
||||||
class StartProject(LiveServerTestCase, AdminScriptTestCase):
|
class StartProject(LiveServerTestCase, AdminScriptTestCase):
|
||||||
|
|
||||||
|
available_apps = [
|
||||||
|
'admin_scripts',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
]
|
||||||
|
|
||||||
def test_wrong_args(self):
|
def test_wrong_args(self):
|
||||||
"Make sure passing the wrong kinds of arguments raises a CommandError"
|
"Make sure passing the wrong kinds of arguments raises a CommandError"
|
||||||
out, err = self.run_django_admin(['startproject'])
|
out, err = self.run_django_admin(['startproject'])
|
||||||
|
|
|
@ -345,6 +345,8 @@ class PostgresNewConnectionTest(TestCase):
|
||||||
# connection would implicitly rollback and cause problems during teardown.
|
# connection would implicitly rollback and cause problems during teardown.
|
||||||
class ConnectionCreatedSignalTest(TransactionTestCase):
|
class ConnectionCreatedSignalTest(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = []
|
||||||
|
|
||||||
# Unfortunately with sqlite3 the in-memory test database cannot be closed,
|
# Unfortunately with sqlite3 the in-memory test database cannot be closed,
|
||||||
# and so it cannot be re-opened during testing.
|
# and so it cannot be re-opened during testing.
|
||||||
@skipUnlessDBFeature('test_db_allows_multiple_connections')
|
@skipUnlessDBFeature('test_db_allows_multiple_connections')
|
||||||
|
@ -514,6 +516,8 @@ class BackendTestCase(TestCase):
|
||||||
# verify if its type is django.database.db.IntegrityError.
|
# verify if its type is django.database.db.IntegrityError.
|
||||||
class FkConstraintsTests(TransactionTestCase):
|
class FkConstraintsTests(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['backends']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Create a Reporter.
|
# Create a Reporter.
|
||||||
self.r = models.Reporter.objects.create(first_name='John', last_name='Smith')
|
self.r = models.Reporter.objects.create(first_name='John', last_name='Smith')
|
||||||
|
@ -777,6 +781,9 @@ class MySQLPKZeroTests(TestCase):
|
||||||
|
|
||||||
|
|
||||||
class DBConstraintTestCase(TransactionTestCase):
|
class DBConstraintTestCase(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['backends']
|
||||||
|
|
||||||
def test_can_reference_existant(self):
|
def test_can_reference_existant(self):
|
||||||
obj = models.Object.objects.create()
|
obj = models.Object.objects.create()
|
||||||
ref = models.ObjectReference.objects.create(obj=obj)
|
ref = models.ObjectReference.objects.create(obj=obj)
|
||||||
|
|
|
@ -686,6 +686,9 @@ class ModelTest(TestCase):
|
||||||
|
|
||||||
|
|
||||||
class ConcurrentSaveTests(TransactionTestCase):
|
class ConcurrentSaveTests(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['basic']
|
||||||
|
|
||||||
@skipUnlessDBFeature('test_db_allows_multiple_connections')
|
@skipUnlessDBFeature('test_db_allows_multiple_connections')
|
||||||
def test_concurrent_delete_with_save(self):
|
def test_concurrent_delete_with_save(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -827,6 +827,8 @@ def custom_key_func(key, key_prefix, version):
|
||||||
|
|
||||||
|
|
||||||
class DBCacheTests(BaseCacheTests, TransactionTestCase):
|
class DBCacheTests(BaseCacheTests, TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = []
|
||||||
backend_name = 'django.core.cache.backends.db.DatabaseCache'
|
backend_name = 'django.core.cache.backends.db.DatabaseCache'
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -16,6 +16,9 @@ from .models import (Book, Award, AwardNote, Person, Child, Toy, PlayedWith,
|
||||||
# Can't run this test under SQLite, because you can't
|
# Can't run this test under SQLite, because you can't
|
||||||
# get two connections to an in-memory database.
|
# get two connections to an in-memory database.
|
||||||
class DeleteLockingTest(TransactionTestCase):
|
class DeleteLockingTest(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['delete_regress']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Create a second connection to the default database
|
# Create a second connection to the default database
|
||||||
new_connections = ConnectionHandler(settings.DATABASES)
|
new_connections = ConnectionHandler(settings.DATABASES)
|
||||||
|
@ -107,6 +110,9 @@ class DeleteCascadeTests(TestCase):
|
||||||
|
|
||||||
|
|
||||||
class DeleteCascadeTransactionTests(TransactionTestCase):
|
class DeleteCascadeTransactionTests(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['delete_regress']
|
||||||
|
|
||||||
def test_inheritance(self):
|
def test_inheritance(self):
|
||||||
"""
|
"""
|
||||||
Auto-created many-to-many through tables referencing a parent model are
|
Auto-created many-to-many through tables referencing a parent model are
|
||||||
|
|
|
@ -621,6 +621,8 @@ class FileLikeObjectTestCase(LiveServerTestCase):
|
||||||
"""
|
"""
|
||||||
Test file-like objects (#15644).
|
Test file-like objects (#15644).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
available_apps = []
|
||||||
urls = 'file_storage.urls'
|
urls = 'file_storage.urls'
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -354,6 +354,13 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
||||||
|
|
||||||
class FixtureTransactionTests(DumpDataAssertMixin, TransactionTestCase):
|
class FixtureTransactionTests(DumpDataAssertMixin, TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = [
|
||||||
|
'fixtures',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.sites',
|
||||||
|
]
|
||||||
|
|
||||||
@skipUnlessDBFeature('supports_forward_references')
|
@skipUnlessDBFeature('supports_forward_references')
|
||||||
def test_format_discovery(self):
|
def test_format_discovery(self):
|
||||||
# Load fixture 1 again, using format discovery
|
# Load fixture 1 again, using format discovery
|
||||||
|
|
|
@ -26,6 +26,9 @@ class SampleTestCase(TestCase):
|
||||||
|
|
||||||
|
|
||||||
class TestNoInitialDataLoading(TransactionTestCase):
|
class TestNoInitialDataLoading(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['fixtures_model_package']
|
||||||
|
|
||||||
def test_syncdb(self):
|
def test_syncdb(self):
|
||||||
transaction.set_autocommit(False)
|
transaction.set_autocommit(False)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -685,6 +685,12 @@ class NaturalKeyFixtureTests(TestCase):
|
||||||
|
|
||||||
class TestTicket11101(TransactionTestCase):
|
class TestTicket11101(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = [
|
||||||
|
'fixtures_regress',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
]
|
||||||
|
|
||||||
def ticket_11101(self):
|
def ticket_11101(self):
|
||||||
management.call_command(
|
management.call_command(
|
||||||
'loaddata',
|
'loaddata',
|
||||||
|
|
|
@ -94,6 +94,8 @@ class GetOrCreateTests(TestCase):
|
||||||
|
|
||||||
class GetOrCreateTransactionTests(TransactionTestCase):
|
class GetOrCreateTransactionTests(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['get_or_create']
|
||||||
|
|
||||||
def test_get_or_create_integrityerror(self):
|
def test_get_or_create_integrityerror(self):
|
||||||
# Regression test for #15117. Requires a TransactionTestCase on
|
# Regression test for #15117. Requires a TransactionTestCase on
|
||||||
# databases that delay integrity checks until the end of transactions,
|
# databases that delay integrity checks until the end of transactions,
|
||||||
|
|
|
@ -37,6 +37,8 @@ class HandlerTests(TestCase):
|
||||||
|
|
||||||
|
|
||||||
class TransactionsPerRequestTests(TransactionTestCase):
|
class TransactionsPerRequestTests(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = []
|
||||||
urls = 'handlers.urls'
|
urls = 'handlers.urls'
|
||||||
|
|
||||||
def test_no_transaction(self):
|
def test_no_transaction(self):
|
||||||
|
|
|
@ -10,6 +10,7 @@ from .models import (Person, Group, Membership, UserMembership, Car, Driver,
|
||||||
|
|
||||||
|
|
||||||
class M2MThroughTestCase(TestCase):
|
class M2MThroughTestCase(TestCase):
|
||||||
|
|
||||||
def test_everything(self):
|
def test_everything(self):
|
||||||
bob = Person.objects.create(name="Bob")
|
bob = Person.objects.create(name="Bob")
|
||||||
jim = Person.objects.create(name="Jim")
|
jim = Person.objects.create(name="Jim")
|
||||||
|
|
|
@ -707,6 +707,9 @@ class TransactionMiddlewareTest(IgnorePendingDeprecationWarningsMixin, Transacti
|
||||||
"""
|
"""
|
||||||
Test the transaction middleware.
|
Test the transaction middleware.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
available_apps = ['middleware']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TransactionMiddlewareTest, self).setUp()
|
super(TransactionMiddlewareTest, self).setUp()
|
||||||
self.request = HttpRequest()
|
self.request = HttpRequest()
|
||||||
|
|
|
@ -22,6 +22,8 @@ class ProxyModelInheritanceTests(TransactionTestCase):
|
||||||
apps and calls syncdb, then verifies that the table has been created.
|
apps and calls syncdb, then verifies that the table has been created.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
available_apps = []
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.old_sys_path = sys.path[:]
|
self.old_sys_path = sys.path[:]
|
||||||
sys.path.append(os.path.dirname(os.path.abspath(upath(__file__))))
|
sys.path.append(os.path.dirname(os.path.abspath(upath(__file__))))
|
||||||
|
@ -38,7 +40,11 @@ class ProxyModelInheritanceTests(TransactionTestCase):
|
||||||
del cache.app_models['app2']
|
del cache.app_models['app2']
|
||||||
|
|
||||||
def test_table_exists(self):
|
def test_table_exists(self):
|
||||||
|
try:
|
||||||
|
cache.set_available_apps(settings.INSTALLED_APPS)
|
||||||
call_command('syncdb', verbosity=0)
|
call_command('syncdb', verbosity=0)
|
||||||
|
finally:
|
||||||
|
cache.unset_available_apps()
|
||||||
from .app1.models import ProxyModel
|
from .app1.models import ProxyModel
|
||||||
from .app2.models import NiceModel
|
from .app2.models import NiceModel
|
||||||
self.assertEqual(NiceModel.objects.all().count(), 0)
|
self.assertEqual(NiceModel.objects.all().count(), 0)
|
||||||
|
|
|
@ -683,6 +683,8 @@ class RequestsTests(SimpleTestCase):
|
||||||
"Cannot establish two connections to an in-memory SQLite database.")
|
"Cannot establish two connections to an in-memory SQLite database.")
|
||||||
class DatabaseConnectionHandlingTests(TransactionTestCase):
|
class DatabaseConnectionHandlingTests(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = []
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Use a temporary connection to avoid messing with the main one.
|
# Use a temporary connection to avoid messing with the main one.
|
||||||
self._old_default_connection = connections['default']
|
self._old_default_connection = connections['default']
|
||||||
|
|
|
@ -72,6 +72,15 @@ def get_installed():
|
||||||
def setup(verbosity, test_labels):
|
def setup(verbosity, test_labels):
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models.loading import get_apps, load_app
|
from django.db.models.loading import get_apps, load_app
|
||||||
|
from django.test.testcases import TransactionTestCase, TestCase
|
||||||
|
|
||||||
|
# Force declaring available_apps in TransactionTestCase for faster tests.
|
||||||
|
def no_available_apps(self):
|
||||||
|
raise Exception("Please define available_apps in TransactionTestCase "
|
||||||
|
"and its subclasses.")
|
||||||
|
TransactionTestCase.available_apps = property(no_available_apps)
|
||||||
|
TestCase.available_apps = None
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
'INSTALLED_APPS': settings.INSTALLED_APPS,
|
'INSTALLED_APPS': settings.INSTALLED_APPS,
|
||||||
'ROOT_URLCONF': getattr(settings, "ROOT_URLCONF", ""),
|
'ROOT_URLCONF': getattr(settings, "ROOT_URLCONF", ""),
|
||||||
|
|
|
@ -23,6 +23,8 @@ requires_threading = unittest.skipUnless(threading, 'requires threading')
|
||||||
|
|
||||||
class SelectForUpdateTests(TransactionTestCase):
|
class SelectForUpdateTests(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['select_for_update']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
transaction.enter_transaction_management()
|
transaction.enter_transaction_management()
|
||||||
self.person = Person.objects.create(name='Reinhardt')
|
self.person = Person.objects.create(name='Reinhardt')
|
||||||
|
|
|
@ -259,6 +259,9 @@ class SerializersTestBase(object):
|
||||||
|
|
||||||
|
|
||||||
class SerializersTransactionTestBase(object):
|
class SerializersTransactionTestBase(object):
|
||||||
|
|
||||||
|
available_apps = ['serializers']
|
||||||
|
|
||||||
def test_forward_refs(self):
|
def test_forward_refs(self):
|
||||||
"""
|
"""
|
||||||
Tests that objects ids can be referenced before they are
|
Tests that objects ids can be referenced before they are
|
||||||
|
|
|
@ -30,8 +30,15 @@ TEST_SETTINGS = {
|
||||||
|
|
||||||
|
|
||||||
class LiveServerBase(LiveServerTestCase):
|
class LiveServerBase(LiveServerTestCase):
|
||||||
urls = 'servers.urls'
|
|
||||||
|
available_apps = [
|
||||||
|
'servers',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
]
|
||||||
fixtures = ['testdata.json']
|
fixtures = ['testdata.json']
|
||||||
|
urls = 'servers.urls'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
|
|
@ -12,6 +12,8 @@ from django.utils import unittest, six
|
||||||
@override_settings(TEST='override')
|
@override_settings(TEST='override')
|
||||||
class FullyDecoratedTranTestCase(TransactionTestCase):
|
class FullyDecoratedTranTestCase(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = []
|
||||||
|
|
||||||
def test_override(self):
|
def test_override(self):
|
||||||
self.assertEqual(settings.TEST, 'override')
|
self.assertEqual(settings.TEST, 'override')
|
||||||
|
|
||||||
|
|
|
@ -318,6 +318,8 @@ class AutoIncrementResetTest(TransactionTestCase):
|
||||||
that AutoField values start from 1 for each transactional test case.
|
that AutoField values start from 1 for each transactional test case.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
available_apps = ['test_runner']
|
||||||
|
|
||||||
reset_sequences = True
|
reset_sequences = True
|
||||||
|
|
||||||
@skipUnlessDBFeature('supports_sequence_reset')
|
@skipUnlessDBFeature('supports_sequence_reset')
|
||||||
|
|
|
@ -26,6 +26,8 @@ class AtomicTests(TransactionTestCase):
|
||||||
syntax and the bulk of the tests use the context manager syntax.
|
syntax and the bulk of the tests use the context manager syntax.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
available_apps = ['transactions']
|
||||||
|
|
||||||
def test_decorator_syntax_commit(self):
|
def test_decorator_syntax_commit(self):
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def make_reporter():
|
def make_reporter():
|
||||||
|
@ -232,6 +234,8 @@ class AtomicInsideLegacyTransactionManagementTests(AtomicTests):
|
||||||
class AtomicMergeTests(TransactionTestCase):
|
class AtomicMergeTests(TransactionTestCase):
|
||||||
"""Test merging transactions with savepoint=False."""
|
"""Test merging transactions with savepoint=False."""
|
||||||
|
|
||||||
|
available_apps = ['transactions']
|
||||||
|
|
||||||
def test_merged_outer_rollback(self):
|
def test_merged_outer_rollback(self):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
Reporter.objects.create(first_name="Tintin")
|
Reporter.objects.create(first_name="Tintin")
|
||||||
|
@ -286,6 +290,8 @@ class AtomicMergeTests(TransactionTestCase):
|
||||||
"'atomic' requires transactions and savepoints.")
|
"'atomic' requires transactions and savepoints.")
|
||||||
class AtomicErrorsTests(TransactionTestCase):
|
class AtomicErrorsTests(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = []
|
||||||
|
|
||||||
def test_atomic_prevents_setting_autocommit(self):
|
def test_atomic_prevents_setting_autocommit(self):
|
||||||
autocommit = transaction.get_autocommit()
|
autocommit = transaction.get_autocommit()
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
@ -311,6 +317,8 @@ class AtomicErrorsTests(TransactionTestCase):
|
||||||
|
|
||||||
class AtomicMiscTests(TransactionTestCase):
|
class AtomicMiscTests(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = []
|
||||||
|
|
||||||
def test_wrap_callable_instance(self):
|
def test_wrap_callable_instance(self):
|
||||||
# Regression test for #20028
|
# Regression test for #20028
|
||||||
class Callable(object):
|
class Callable(object):
|
||||||
|
@ -322,6 +330,8 @@ class AtomicMiscTests(TransactionTestCase):
|
||||||
|
|
||||||
class TransactionTests(IgnorePendingDeprecationWarningsMixin, TransactionTestCase):
|
class TransactionTests(IgnorePendingDeprecationWarningsMixin, TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['transactions']
|
||||||
|
|
||||||
def create_a_reporter_then_fail(self, first, last):
|
def create_a_reporter_then_fail(self, first, last):
|
||||||
a = Reporter(first_name=first, last_name=last)
|
a = Reporter(first_name=first, last_name=last)
|
||||||
a.save()
|
a.save()
|
||||||
|
@ -477,6 +487,9 @@ class TransactionTests(IgnorePendingDeprecationWarningsMixin, TransactionTestCas
|
||||||
|
|
||||||
|
|
||||||
class TransactionRollbackTests(IgnorePendingDeprecationWarningsMixin, TransactionTestCase):
|
class TransactionRollbackTests(IgnorePendingDeprecationWarningsMixin, TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['transactions']
|
||||||
|
|
||||||
def execute_bad_sql(self):
|
def execute_bad_sql(self):
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
cursor.execute("INSERT INTO transactions_reporter (first_name, last_name) VALUES ('Douglas', 'Adams');")
|
cursor.execute("INSERT INTO transactions_reporter (first_name, last_name) VALUES ('Douglas', 'Adams');")
|
||||||
|
@ -494,6 +507,9 @@ class TransactionRollbackTests(IgnorePendingDeprecationWarningsMixin, Transactio
|
||||||
transaction.rollback()
|
transaction.rollback()
|
||||||
|
|
||||||
class TransactionContextManagerTests(IgnorePendingDeprecationWarningsMixin, TransactionTestCase):
|
class TransactionContextManagerTests(IgnorePendingDeprecationWarningsMixin, TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['transactions']
|
||||||
|
|
||||||
def create_reporter_and_fail(self):
|
def create_reporter_and_fail(self):
|
||||||
Reporter.objects.create(first_name="Bob", last_name="Holtzman")
|
Reporter.objects.create(first_name="Bob", last_name="Holtzman")
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
|
@ -10,6 +10,9 @@ from django.utils.unittest import skipIf, skipUnless
|
||||||
from .models import Mod, M2mA, M2mB, SubMod
|
from .models import Mod, M2mA, M2mB, SubMod
|
||||||
|
|
||||||
class ModelInheritanceTests(TransactionTestCase):
|
class ModelInheritanceTests(TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['transactions_regress']
|
||||||
|
|
||||||
def test_save(self):
|
def test_save(self):
|
||||||
# First, create a SubMod, then try to save another with conflicting
|
# First, create a SubMod, then try to save another with conflicting
|
||||||
# cnt field. The problem was that transactions were committed after
|
# cnt field. The problem was that transactions were committed after
|
||||||
|
@ -33,6 +36,13 @@ class TestTransactionClosing(IgnorePendingDeprecationWarningsMixin, TransactionT
|
||||||
when they should be, and aren't left pending after operations
|
when they should be, and aren't left pending after operations
|
||||||
have been performed in them. Refs #9964.
|
have been performed in them. Refs #9964.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
available_apps = [
|
||||||
|
'transactions_regress',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
]
|
||||||
|
|
||||||
def test_raw_committed_on_success(self):
|
def test_raw_committed_on_success(self):
|
||||||
"""
|
"""
|
||||||
Make sure a transaction consisting of raw SQL execution gets
|
Make sure a transaction consisting of raw SQL execution gets
|
||||||
|
@ -188,6 +198,9 @@ class TestNewConnection(IgnorePendingDeprecationWarningsMixin, TransactionTestCa
|
||||||
"""
|
"""
|
||||||
Check that new connections don't have special behaviour.
|
Check that new connections don't have special behaviour.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
available_apps = ['transactions_regress']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self._old_backend = connections[DEFAULT_DB_ALIAS]
|
self._old_backend = connections[DEFAULT_DB_ALIAS]
|
||||||
settings = self._old_backend.settings_dict.copy()
|
settings = self._old_backend.settings_dict.copy()
|
||||||
|
@ -235,6 +248,9 @@ class TestPostgresAutocommitAndIsolation(IgnorePendingDeprecationWarningsMixin,
|
||||||
is restored after entering and leaving transaction management.
|
is restored after entering and leaving transaction management.
|
||||||
Refs #16047, #18130.
|
Refs #16047, #18130.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
available_apps = ['transactions_regress']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
from psycopg2.extensions import (ISOLATION_LEVEL_AUTOCOMMIT,
|
from psycopg2.extensions import (ISOLATION_LEVEL_AUTOCOMMIT,
|
||||||
ISOLATION_LEVEL_SERIALIZABLE,
|
ISOLATION_LEVEL_SERIALIZABLE,
|
||||||
|
@ -311,6 +327,9 @@ class TestPostgresAutocommitAndIsolation(IgnorePendingDeprecationWarningsMixin,
|
||||||
|
|
||||||
|
|
||||||
class TestManyToManyAddTransaction(IgnorePendingDeprecationWarningsMixin, TransactionTestCase):
|
class TestManyToManyAddTransaction(IgnorePendingDeprecationWarningsMixin, TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['transactions_regress']
|
||||||
|
|
||||||
def test_manyrelated_add_commit(self):
|
def test_manyrelated_add_commit(self):
|
||||||
"Test for https://code.djangoproject.com/ticket/16818"
|
"Test for https://code.djangoproject.com/ticket/16818"
|
||||||
a = M2mA.objects.create()
|
a = M2mA.objects.create()
|
||||||
|
@ -327,6 +346,8 @@ class TestManyToManyAddTransaction(IgnorePendingDeprecationWarningsMixin, Transa
|
||||||
|
|
||||||
class SavepointTest(IgnorePendingDeprecationWarningsMixin, TransactionTestCase):
|
class SavepointTest(IgnorePendingDeprecationWarningsMixin, TransactionTestCase):
|
||||||
|
|
||||||
|
available_apps = ['transactions_regress']
|
||||||
|
|
||||||
@skipIf(connection.vendor == 'sqlite',
|
@skipIf(connection.vendor == 'sqlite',
|
||||||
"SQLite doesn't support savepoints in managed mode")
|
"SQLite doesn't support savepoints in managed mode")
|
||||||
@skipUnlessDBFeature('uses_savepoints')
|
@skipUnlessDBFeature('uses_savepoints')
|
||||||
|
|
|
@ -183,6 +183,8 @@ skip_selenium = not os.environ.get('DJANGO_SELENIUM_TESTS', False)
|
||||||
@unittest.skipIf(skip_selenium, 'Selenium tests not requested')
|
@unittest.skipIf(skip_selenium, 'Selenium tests not requested')
|
||||||
@unittest.skipUnless(firefox, 'Selenium not installed')
|
@unittest.skipUnless(firefox, 'Selenium not installed')
|
||||||
class JavascriptI18nTests(LiveServerTestCase):
|
class JavascriptI18nTests(LiveServerTestCase):
|
||||||
|
|
||||||
|
available_apps = []
|
||||||
urls = 'view_tests.urls'
|
urls = 'view_tests.urls'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in New Issue