diff --git a/tests/compiler_test.py b/tests/compiler_test.py index 6773b75..a40ebb0 100644 --- a/tests/compiler_test.py +++ b/tests/compiler_test.py @@ -18,7 +18,6 @@ # However, if you have executed another commercial license agreement # with Crate these terms will supersede the license and you may use the # software solely pursuant to the terms of the relevant commercial agreement. -import sys import warnings from textwrap import dedent from unittest import mock, skipIf, TestCase @@ -289,8 +288,7 @@ def test_for_update(self): FakeCursor = MagicMock(name='FakeCursor', spec=Cursor) -@skipIf(SA_VERSION < SA_1_4 and (3, 9) <= sys.version_info < (3, 10), - "SQLAlchemy 1.3 has problems with these test cases on Python 3.9") +@skipIf(SA_VERSION < SA_1_4, "SQLAlchemy 1.3 suddenly has problems with these test cases") class CompilerTestCase(TestCase): """ A base class for providing mocking infrastructure to validate the DDL compiler. diff --git a/tests/datetime_test.py b/tests/datetime_test.py index 07e98ed..53c30fc 100644 --- a/tests/datetime_test.py +++ b/tests/datetime_test.py @@ -20,13 +20,17 @@ # software solely pursuant to the terms of the relevant commercial agreement. from __future__ import absolute_import + from datetime import datetime, tzinfo, timedelta -from unittest import TestCase +from unittest import TestCase, skipIf from unittest.mock import patch, MagicMock import sqlalchemy as sa from sqlalchemy.exc import DBAPIError from sqlalchemy.orm import Session + +from sqlalchemy_cratedb import SA_VERSION, SA_1_4 + try: from sqlalchemy.orm import declarative_base except ImportError: @@ -52,6 +56,7 @@ def dst(self, date_time): return timedelta(seconds=-7200) +@skipIf(SA_VERSION < SA_1_4, "SQLAlchemy 1.3 suddenly has problems with these test cases") @patch('crate.client.connection.Cursor', FakeCursor) class SqlAlchemyDateAndDateTimeTest(TestCase): diff --git a/tests/dict_test.py b/tests/dict_test.py index 84b6f49..5f2692c 100644 --- a/tests/dict_test.py +++ b/tests/dict_test.py @@ -20,7 +20,8 @@ # software solely pursuant to the terms of the relevant commercial agreement. from __future__ import absolute_import -from unittest import TestCase + +from unittest import TestCase, skipIf from unittest.mock import patch, MagicMock import sqlalchemy as sa @@ -31,7 +32,7 @@ except ImportError: from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy_cratedb import ObjectArray, ObjectType +from sqlalchemy_cratedb import ObjectArray, ObjectType, SA_VERSION, SA_1_4 from crate.client.cursor import Cursor @@ -40,6 +41,7 @@ FakeCursor.return_value = fake_cursor +@skipIf(SA_VERSION < SA_1_4, "SQLAlchemy 1.3 suddenly has problems with these test cases") class SqlAlchemyDictTypeTest(TestCase): def setUp(self): diff --git a/tests/insert_from_select_test.py b/tests/insert_from_select_test.py index 692dfa5..a4533a5 100644 --- a/tests/insert_from_select_test.py +++ b/tests/insert_from_select_test.py @@ -18,14 +18,16 @@ # However, if you have executed another commercial license agreement # with Crate these terms will supersede the license and you may use the # software solely pursuant to the terms of the relevant commercial agreement. - from datetime import datetime -from unittest import TestCase +from unittest import TestCase, skipIf from unittest.mock import patch, MagicMock import sqlalchemy as sa from sqlalchemy import select, insert from sqlalchemy.orm import Session + +from sqlalchemy_cratedb import SA_VERSION, SA_1_4 + try: from sqlalchemy.orm import declarative_base except ImportError: @@ -40,6 +42,7 @@ FakeCursor.return_value = fake_cursor +@skipIf(SA_VERSION < SA_1_4, "SQLAlchemy 1.3 suddenly has problems with these test cases") class SqlAlchemyInsertFromSelectTest(TestCase): def assertSQL(self, expected_str, actual_expr): diff --git a/tests/update_test.py b/tests/update_test.py index 5062f22..a70b56c 100644 --- a/tests/update_test.py +++ b/tests/update_test.py @@ -18,12 +18,11 @@ # However, if you have executed another commercial license agreement # with Crate these terms will supersede the license and you may use the # software solely pursuant to the terms of the relevant commercial agreement. - from datetime import datetime -from unittest import TestCase +from unittest import TestCase, skipIf from unittest.mock import patch, MagicMock -from sqlalchemy_cratedb import ObjectType +from sqlalchemy_cratedb import ObjectType, SA_VERSION, SA_1_4 import sqlalchemy as sa from sqlalchemy.orm import Session @@ -41,6 +40,7 @@ FakeCursor.return_value = fake_cursor +@skipIf(SA_VERSION < SA_1_4, "SQLAlchemy 1.3 suddenly has problems with these test cases") class SqlAlchemyUpdateTest(TestCase): def setUp(self):