Skip to content

Commit

Permalink
Add gino tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uriyyo committed Dec 29, 2024
1 parent 02c63d3 commit b841ebf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 5 additions & 2 deletions fastapi_pagination/ext/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
import warnings
from collections.abc import Sequence
from contextlib import suppress
from typing import Any, Optional, TypeVar, Union, cast, overload
from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union, cast, overload

from sqlalchemy import func, select, text
from sqlalchemy.engine import Connection
from sqlalchemy.exc import InvalidRequestError
from sqlalchemy.ext.asyncio import AsyncConnection, AsyncSession
from sqlalchemy.orm import Query, Session, noload, scoped_session
from sqlalchemy.sql import CompoundSelect, Select
from sqlalchemy.sql.elements import TextClause
Expand All @@ -30,6 +29,10 @@

from .utils import generic_query_apply_params, unwrap_scalars

if TYPE_CHECKING:
from sqlalchemy.ext.asyncio import AsyncConnection, AsyncSession


try:
from sqlalchemy.orm import FromStatement
except ImportError:
Expand Down
12 changes: 7 additions & 5 deletions scripts/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,17 @@ if [[ "$PYDANTIC_V2" == true ]]; then
_pip uninstall -y ormar
fi

#echo "Running tests GINO tests"
#_pip install -U "gino[starlette]"
#_pytest tests -m gino
#_pip uninstall -y gino gino-starlette

echo "Running orm tests"
_pip install "databases<0.9.0" orm
_pytest tests/ext -m orm
_pip uninstall -y orm

if [[ "$PYDANTIC_V2" == true ]]; then
echo "Running tests GINO tests"
_pip install -U "gino[starlette]" "sqlalchemy<1.4" "asyncpg"
_pytest tests -m gino
_pip uninstall -y gino gino-starlette
fi

echo "Restore env"
poetry install -E all --sync
2 changes: 2 additions & 0 deletions tests/ext/test_gino.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def query(request, user_cls):
class TestGino(BasePaginationTestSuite):
@pytest.fixture(scope="session")
def app(self, builder, db, query):
builder = builder.new()

@builder.both.default
async def route():
return await paginate(query)
Expand Down

0 comments on commit b841ebf

Please sign in to comment.