diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-03-17 13:50:50 -0400 |
---|---|---|
committer | Victor Sergeyev <vsergeyev@mirantis.com> | 2015-03-18 10:43:57 +0200 |
commit | 7bb0356e5f83d08a8cf7fc15888ba7d1b5218038 (patch) | |
tree | 4f94416814522df628124366ec7da6e0db95c11b | |
parent | de9439c457dc865d2192684f0292d59674afc785 (diff) | |
download | oslo-db-7bb0356e5f83d08a8cf7fc15888ba7d1b5218038.tar.gz |
Provide working SQLA_VERSION attribute
Repairs the parsing within test_utils tests
to use the alphabetic-supporting version
parser inside of compat/utils. Necessary in
order to work with beta / dev versions of SQLAlchemy
such as the current 1.0.0b1 release.
Change-Id: Ic1ae9fa18171b687b1bb9cfac7411fac14e29a0f
-rw-r--r-- | oslo_db/sqlalchemy/compat/utils.py | 12 | ||||
-rw-r--r-- | oslo_db/tests/old_import_api/sqlalchemy/test_utils.py | 3 | ||||
-rw-r--r-- | oslo_db/tests/sqlalchemy/test_utils.py | 3 |
3 files changed, 10 insertions, 8 deletions
diff --git a/oslo_db/sqlalchemy/compat/utils.py b/oslo_db/sqlalchemy/compat/utils.py index e817718..8ebffcc 100644 --- a/oslo_db/sqlalchemy/compat/utils.py +++ b/oslo_db/sqlalchemy/compat/utils.py @@ -14,16 +14,16 @@ import re import sqlalchemy -_SQLA_VERSION = tuple( +SQLA_VERSION = tuple( int(num) if re.match(r'^\d+$', num) else num for num in sqlalchemy.__version__.split(".") ) -sqla_100 = _SQLA_VERSION >= (1, 0, 0) -sqla_097 = _SQLA_VERSION >= (0, 9, 7) -sqla_094 = _SQLA_VERSION >= (0, 9, 4) -sqla_090 = _SQLA_VERSION >= (0, 9, 0) -sqla_08 = _SQLA_VERSION >= (0, 8) +sqla_100 = SQLA_VERSION >= (1, 0, 0) +sqla_097 = SQLA_VERSION >= (0, 9, 7) +sqla_094 = SQLA_VERSION >= (0, 9, 4) +sqla_090 = SQLA_VERSION >= (0, 9, 0) +sqla_08 = SQLA_VERSION >= (0, 8) def get_postgresql_enums(conn): diff --git a/oslo_db/tests/old_import_api/sqlalchemy/test_utils.py b/oslo_db/tests/old_import_api/sqlalchemy/test_utils.py index fea7fbd..9c488a2 100644 --- a/oslo_db/tests/old_import_api/sqlalchemy/test_utils.py +++ b/oslo_db/tests/old_import_api/sqlalchemy/test_utils.py @@ -38,11 +38,12 @@ from oslo.db.sqlalchemy import provision from oslo.db.sqlalchemy import session from oslo.db.sqlalchemy import test_base as db_test_base from oslo.db.sqlalchemy import utils +from oslo_db.sqlalchemy.compat import utils as compat_utils from oslo_db.sqlalchemy import utils as private_utils from oslo_db.tests.old_import_api import utils as test_utils -SA_VERSION = tuple(map(int, sqlalchemy.__version__.split('.'))) +SA_VERSION = compat_utils.SQLA_VERSION Base = declarative_base() diff --git a/oslo_db/tests/sqlalchemy/test_utils.py b/oslo_db/tests/sqlalchemy/test_utils.py index 06a1445..3b511ba 100644 --- a/oslo_db/tests/sqlalchemy/test_utils.py +++ b/oslo_db/tests/sqlalchemy/test_utils.py @@ -33,6 +33,7 @@ from sqlalchemy.sql import select from sqlalchemy.types import UserDefinedType, NullType from oslo_db import exception +from oslo_db.sqlalchemy.compat import utils as compat_utils from oslo_db.sqlalchemy import models from oslo_db.sqlalchemy import provision from oslo_db.sqlalchemy import session @@ -42,7 +43,7 @@ from oslo_db.tests import utils as test_utils Base = declarative_base() -SA_VERSION = tuple(map(int, sqlalchemy.__version__.split('.'))) +SA_VERSION = compat_utils.SQLA_VERSION class TestSanitizeDbUrl(test_base.BaseTestCase): |