Ticket #18984: 18984-deadlock-test-case.diff

File 18984-deadlock-test-case.diff, 1.2 KB (added by Aymeric Augustin, 12 years ago)
  • tests/regressiontests/test_runner/tests.py

    diff --git a/tests/regressiontests/test_runner/tests.py b/tests/regressiontests/test_runner/tests.py
    index c723f16..fa5df36 100644
    a b from __future__ import absolute_import  
    55
    66from optparse import make_option
    77
     8from django.conf import settings
    89from django.core.exceptions import ImproperlyConfigured
    910from django.core.management import call_command
    1011from django import db
    class AutoIncrementResetTest(TransactionTestCase):  
    279280    def test_autoincrement_reset2(self):
    280281        p = Person.objects.create(first_name='Jack', last_name='Smith')
    281282        self.assertEqual(p.pk, 1)
     283
     284
     285class MirrorDeadlockTest(TransactionTestCase):
     286    multi_db = True
     287
     288    def test_teardown_deadlock(self):
     289        # If pour DATABASES setting must contain a mirror obeying the following rules...
     290        default = settings.DATABASES['default'].copy()
     291        mirror = settings.DATABASES['mirror'].copy()
     292        self.assertEqual(default.pop('TEST_MIRROR'), None)
     293        self.assertEqual(mirror.pop('TEST_MIRROR'), 'default')
     294        self.assertEqual(mirror, default)
     295        # ... sorry.
     296        print("You're going to deadlock, human. MUHAHA.")
Back to Top