diff --git a/test/conftest.py b/test/conftest.py index 05e7c50..33fbce2 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -110,12 +110,11 @@ def is_sqlite(db_uri): @pytest.fixture(scope='session') def is_sqlalchemy_1_3_or_higer(): - try: - from sqlalchemy import JSON # noqa: F401 - except ImportError: - return False - else: + import sqlalchemy + if sqlalchemy.__version__ >= '1.3.0': return True + else: + return False @pytest.fixture(scope='session') diff --git a/test/models.py b/test/models.py index d769a31..8038194 100644 --- a/test/models.py +++ b/test/models.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import sqlalchemy from sqlalchemy import ( Column, Date, DateTime, ForeignKey, Integer, String, Time ) @@ -64,15 +65,14 @@ class Corge(BasePostgresqlSpecific): tags = Column(ARRAY(String, dimensions=1)) -try: +if sqlalchemy.__version__ >= '1.3.0': + from sqlalchemy import JSON -except ImportError: - class Til(Base): - __tablename__ = 'til' -else: class Til(Base): __tablename__ = 'til' refer_info = Column(JSON) +else: + Til = None