Skip to content

Commit b841ebf

Browse files
committed
Add gino tests
1 parent 02c63d3 commit b841ebf

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

fastapi_pagination/ext/sqlalchemy.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
import warnings
1313
from collections.abc import Sequence
1414
from contextlib import suppress
15-
from typing import Any, Optional, TypeVar, Union, cast, overload
15+
from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union, cast, overload
1616

1717
from sqlalchemy import func, select, text
1818
from sqlalchemy.engine import Connection
1919
from sqlalchemy.exc import InvalidRequestError
20-
from sqlalchemy.ext.asyncio import AsyncConnection, AsyncSession
2120
from sqlalchemy.orm import Query, Session, noload, scoped_session
2221
from sqlalchemy.sql import CompoundSelect, Select
2322
from sqlalchemy.sql.elements import TextClause
@@ -30,6 +29,10 @@
3029

3130
from .utils import generic_query_apply_params, unwrap_scalars
3231

32+
if TYPE_CHECKING:
33+
from sqlalchemy.ext.asyncio import AsyncConnection, AsyncSession
34+
35+
3336
try:
3437
from sqlalchemy.orm import FromStatement
3538
except ImportError:

scripts/ci-test.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,17 @@ if [[ "$PYDANTIC_V2" == true ]]; then
5555
_pip uninstall -y ormar
5656
fi
5757

58-
#echo "Running tests GINO tests"
59-
#_pip install -U "gino[starlette]"
60-
#_pytest tests -m gino
61-
#_pip uninstall -y gino gino-starlette
62-
6358
echo "Running orm tests"
6459
_pip install "databases<0.9.0" orm
6560
_pytest tests/ext -m orm
6661
_pip uninstall -y orm
6762

63+
if [[ "$PYDANTIC_V2" == true ]]; then
64+
echo "Running tests GINO tests"
65+
_pip install -U "gino[starlette]" "sqlalchemy<1.4" "asyncpg"
66+
_pytest tests -m gino
67+
_pip uninstall -y gino gino-starlette
68+
fi
69+
6870
echo "Restore env"
6971
poetry install -E all --sync

tests/ext/test_gino.py

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def query(request, user_cls):
4343
class TestGino(BasePaginationTestSuite):
4444
@pytest.fixture(scope="session")
4545
def app(self, builder, db, query):
46+
builder = builder.new()
47+
4648
@builder.both.default
4749
async def route():
4850
return await paginate(query)

0 commit comments

Comments
 (0)