Ticket #18319: django-ticket18319.diff

File django-ticket18319.diff, 2.5 KB (added by Michael Manfre, 12 years ago)

Changed check for newly added supports_sequence_reset database feature

  • django/db/backends/__init__.py

    diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
    index 2762350..61f2df3 100644
    a b class BaseDatabaseFeatures(object):  
    398398    # Does the backend support tablespaces? Default to False because it isn't
    399399    # in the SQL standard.
    400400    supports_tablespaces = False
     401   
     402    # Does the backend reset sequences between tests?
     403    supports_sequence_reset = True
    401404
    402405    # Features that need to be confirmed at runtime
    403406    # Cache whether the confirmation has been performed.
  • django/db/backends/oracle/base.py

    diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
    index 2f3a43d..fe512df 100644
    a b class DatabaseFeatures(BaseDatabaseFeatures):  
    8383    ignores_nulls_in_unique_constraints = False
    8484    has_bulk_insert = True
    8585    supports_tablespaces = True
     86    supports_sequence_reset = False
    8687
    8788class DatabaseOperations(BaseDatabaseOperations):
    8889    compiler_module = "django.db.backends.oracle.compiler"
  • tests/regressiontests/test_runner/tests.py

    diff --git a/tests/regressiontests/test_runner/tests.py b/tests/regressiontests/test_runner/tests.py
    index 3a8a4ef..0ecb3a1 100644
    a b class AutoIncrementResetTest(TransactionTestCase):  
    291291    and check that both times they get "1" as their PK value. That is, we test
    292292    that AutoField values start from 1 for each transactional test case.
    293293    """
    294     @unittest.skipIf(connection.vendor == 'oracle',
    295                      "Oracle's auto-increment fields are not reset between "
    296                      "tests")
     294    @unittest.skipIf(not connection.features.supports_sequence_reset,
     295                     "Database backend's auto-increment fields are not reset "
     296                     "between tests")
    297297    def test_autoincrement_reset1(self):
    298298        p = Person.objects.create(first_name='Jack', last_name='Smith')
    299299        self.assertEqual(p.pk, 1)
    300300
    301     @unittest.skipIf(connection.vendor == 'oracle',
    302                      "Oracle's auto-increment fields are not reset between "
    303                      "tests")
     301    @unittest.skipIf(not connection.features.supports_sequence_reset,
     302                     "Database backend's auto-increment fields are not reset "
     303                     "between tests")
    304304    def test_autoincrement_reset2(self):
    305305        p = Person.objects.create(first_name='Jack', last_name='Smith')
    306306        self.assertEqual(p.pk, 1)
Back to Top