From: Mike Bayer Date: Wed, 6 Jan 2021 17:50:22 +0000 (-0500) Subject: repair ORM tests that use deferrable FKs X-Git-Tag: rel_1_4_0b2~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bbb8a38295e960566366971637910fe58cce65a0;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git repair ORM tests that use deferrable FKs 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 --- diff --git a/test/orm/test_deprecations.py b/test/orm/test_deprecations.py index 7d7432d556..6d946cfe6e 100644 --- a/test/orm/test_deprecations.py +++ b/test/orm/test_deprecations.py @@ -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): diff --git a/test/orm/test_naturalpks.py b/test/orm/test_naturalpks.py index a609c89aeb..4a3fee6343 100644 --- a/test/orm/test_naturalpks.py +++ b/test/orm/test_naturalpks.py @@ -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() diff --git a/test/requirements.py b/test/requirements.py index 5413d217e0..d5a7183727 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -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):