Skip to content

Commit

Permalink
Merge pull request #1255 from uriyyo/dependabot/pip/pytest-asyncio-0.…
Browse files Browse the repository at this point in the history
…24.0

[no ci]
  • Loading branch information
github-actions[bot] authored Sep 10, 2024
2 parents 4f648b5 + ff6db62 commit bac2098
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 13 deletions.
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bunnet = {version = "^1.1.0", optional = true}
fastapi = ">=0.93.0"
pytest = "^8.3.2"
pytest-cov = "^5.0.0"
pytest-asyncio = "^0.21.1"
pytest-asyncio = "^0.24.0"
flaky = "^3.8.1"
pre-commit = "^3.5.0"
Faker = "^28.4.1"
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[pytest]
asyncio_default_fixture_loop_scope=session

addopts =
--cov=fastapi_pagination
Expand Down
2 changes: 1 addition & 1 deletion tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async def run_pagination_test(
*[f"limit-offset-{key}" for key in _params_desc],
],
)
@mark.asyncio
@mark.asyncio(loop_scope="session")
async def test_pagination(
self,
client,
Expand Down
2 changes: 1 addition & 1 deletion tests/ext/test_cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def route():
return add_pagination(app)


@mark.asyncio
@mark.asyncio(loop_scope="session")
async def test_cursor(app, client, entities):
entities = sorted(parse_obj_as(List[UserOut], entities), key=(lambda it: (it.id, it.name)))

Expand Down
6 changes: 3 additions & 3 deletions tests/ext/test_sqlalchemy_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def route_on_order(db: Session = Depends(get_db)):


@sqlalchemy20
@mark.asyncio
@mark.asyncio(loop_scope="session")
async def test_cursor(app, client, entities):
entities = sorted(parse_obj_as(List[UserOut], entities), key=(lambda it: (it.id, it.name)))

Expand Down Expand Up @@ -90,7 +90,7 @@ async def test_cursor(app, client, entities):


@sqlalchemy20
@mark.asyncio
@mark.asyncio(loop_scope="session")
async def test_cursor_refetch(app, client, entities, postgres_url):
entities = sorted(parse_obj_as(List[UserOut], entities), key=(lambda it: (it.id, it.name)))
first_85_entities = entities[:85]
Expand Down Expand Up @@ -180,7 +180,7 @@ async def test_cursor_refetch(app, client, entities, postgres_url):


@sqlalchemy20
@mark.asyncio
@mark.asyncio(loop_scope="session")
async def test_no_order(app, client, entities):
with raises(
ValueError,
Expand Down
14 changes: 14 additions & 0 deletions tests/patch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import asyncio
from functools import lru_cache

from pydantic import generics

# https://github.com/pydantic/pydantic/issues/4483
generics._generic_types_cache = {}
generics._assigned_parameters = {}


@lru_cache()
def _get_event_loop_no_warn(*_):
loop = asyncio.new_event_loop()
loop.__pytest_asyncio = True

return loop


# plugin._get_event_loop_no_warn = _get_event_loop_no_warn

0 comments on commit bac2098

Please sign in to comment.