Skip to content

Commit

Permalink
Only support sqlalchemy1.3.x or higher
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdavidzeng committed Jun 17, 2020
1 parent 59dc537 commit c5dce9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
9 changes: 4 additions & 5 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
10 changes: 5 additions & 5 deletions test/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-

import sqlalchemy
from sqlalchemy import (
Column, Date, DateTime, ForeignKey, Integer, String, Time
)
Expand Down Expand Up @@ -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

0 comments on commit c5dce9b

Please sign in to comment.