]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
repair ORM tests that use deferrable FKs
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 6 Jan 2021 17:50:22 +0000 (12:50 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 6 Jan 2021 17:50:22 +0000 (12:50 -0500)
after the bound metadata merge the unitofwork.TransactionTest
became deprecations.AutocommitClosesOnFail and was found to
be not actually running correctly on SQLite.  This test
should only run on a backend that has deferrable FKs,
which includes PostgreSQL; so add that to requirements.  this
in turn requires clarification of test_naturalpks that the
"deferrable FKs" req there is more about Oracle and its lack
of ON UPDATE cascades.

Change-Id: I867a164679274940803852c1af0920da74683bfa

test/orm/test_deprecations.py
test/orm/test_naturalpks.py
test/requirements.py

index 7d7432d5562ef033321e1c7f9486de9545dfd582..6d946cfe6e57cbcb6ef096e063626eaa48c01ca7 100644 (file)
@@ -2198,7 +2198,7 @@ class SessionTest(fixtures.RemovesEvents, _LocalFixture):
 
 
 class AutocommitClosesOnFailTest(fixtures.MappedTest):
-    __requires__ = ("deferrable_or_no_constraints",)
+    __requires__ = ("deferrable_fks",)
 
     @classmethod
     def define_tables(cls, metadata):
index a609c89aebf5b227f756174903711b7b229627d5..4a3fee6343272e4e5fffc8dd8ba606777e9355e7 100644 (file)
@@ -28,7 +28,10 @@ from test.orm import _fixtures
 
 
 def _backend_specific_fk_args():
-    if testing.requires.deferrable_fks.enabled:
+    if (
+        testing.requires.deferrable_fks.enabled
+        and testing.requires.non_updating_cascade.enabled
+    ):
         fk_args = dict(deferrable=True, initially="deferred")
     elif not testing.requires.on_update_cascade.enabled:
         fk_args = dict()
index 5413d217e01572d8986bff5b835932494a12f940..d5a718372762fbb0f67bfc3b1a44e004f1d64bd1 100644 (file)
@@ -120,7 +120,7 @@ class DefaultRequirements(SuiteRequirements):
     def deferrable_fks(self):
         """target database must support deferrable fks"""
 
-        return only_on(["oracle"])
+        return only_on(["oracle", "postgresql"])
 
     @property
     def foreign_key_constraint_option_reflection_ondelete(self):