From b526a115e774fecc6e5df0edcbb239b80a367e2a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 31 May 2017 17:12:41 -0400 Subject: [PATCH] - Fixed unit tests to run correctly under the SQLAlchemy 1.0.x series prior to version 1.0.10 where a particular bug involving Postgresql exclude constraints was fixed. Change-Id: Ief64b19b75e4c2c3661ac95d5b03d0c8e0fe5619 Fixes: #431 --- alembic/testing/requirements.py | 7 +++++++ alembic/util/__init__.py | 2 +- alembic/util/sqla_compat.py | 1 + docs/build/changelog.rst | 8 ++++++++ tests/test_postgresql.py | 2 +- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/alembic/testing/requirements.py b/alembic/testing/requirements.py index 0d90643..4468ef2 100644 --- a/alembic/testing/requirements.py +++ b/alembic/testing/requirements.py @@ -103,6 +103,13 @@ class SuiteRequirements(Requirements): "SQLAlchemy 1.0.0 or greater required" ) + @property + def fail_before_sqla_1010(self): + return exclusions.fails_if( + lambda config: not util.sqla_1010, + "SQLAlchemy 1.0.10 or greater required" + ) + @property def fail_before_sqla_099(self): return exclusions.fails_if( diff --git a/alembic/util/__init__.py b/alembic/util/__init__.py index 2241111..bb249dc 100644 --- a/alembic/util/__init__.py +++ b/alembic/util/__init__.py @@ -8,7 +8,7 @@ from .pyfiles import ( # noqa pyc_file_from_path, load_python_file, edit) from .sqla_compat import ( # noqa sqla_07, sqla_079, sqla_08, sqla_083, sqla_084, sqla_09, sqla_092, - sqla_094, sqla_099, sqla_100, sqla_105, sqla_110) + sqla_094, sqla_099, sqla_100, sqla_105, sqla_110, sqla_1010) from .exc import CommandError diff --git a/alembic/util/sqla_compat.py b/alembic/util/sqla_compat.py index 28a6548..57eacd5 100644 --- a/alembic/util/sqla_compat.py +++ b/alembic/util/sqla_compat.py @@ -28,6 +28,7 @@ sqla_094 = _vers >= (0, 9, 4) sqla_099 = _vers >= (0, 9, 9) sqla_100 = _vers >= (1, 0, 0) sqla_105 = _vers >= (1, 0, 5) +sqla_1010 = _vers >= (1, 0, 10) sqla_110 = _vers >= (1, 1, 0) if sqla_08: diff --git a/docs/build/changelog.rst b/docs/build/changelog.rst index 6cec111..9a4b152 100644 --- a/docs/build/changelog.rst +++ b/docs/build/changelog.rst @@ -7,6 +7,14 @@ Changelog :version: 0.9.3 :released: + .. change:: 431 + :tags: bug, tests + :tickets: 431 + + Fixed unit tests to run correctly under the SQLAlchemy 1.0.x series + prior to version 1.0.10 where a particular bug involving Postgresql + exclude constraints was fixed. + .. changelog:: :version: 0.9.2 :released: May 18, 2017 diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py index 2ceeaa9..f02deeb 100644 --- a/tests/test_postgresql.py +++ b/tests/test_postgresql.py @@ -104,7 +104,7 @@ class PostgresqlOpTest(TestBase): '("SomeColumn" WITH >) WHERE ("SomeColumn" > 5)' ) - @config.requirements.fail_before_sqla_100 + @config.requirements.fail_before_sqla_1010 def test_create_exclude_constraint_quoted_column(self): context = op_fixture("postgresql") op.create_exclude_constraint(