⚡️ Speed up test suite via caching and fixture scopes to make it ~24% faster (#13583)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
Roman PostnovandSebastián Ramírez authored and GitHub committed 2026-05-23 17:32:48 +02:00
1 parent 4f37a43d32
commit 8b647e3405
3 files changed
+22

No files matched your search

@@ -25,6 +25,7 @@ def clear_sqlmodel():
pytest.param("tutorial001_py310", marks=needs_py310),
pytest.param("tutorial001_an_py310", marks=needs_py310),
],
scope="module",
)
def get_client(request: pytest.FixtureRequest):
clear_sqlmodel()
@@ -44,6 +45,8 @@ def get_client(request: pytest.FixtureRequest):
# Clean up connection explicitly to avoid resource warning
mod.engine.dispose()
mod.engine.dispose()
def test_crud_app(client: TestClient):
# TODO: this warns that SQLModel.from_orm is deprecated in Pydantic v1, refactor
@@ -25,6 +25,7 @@ def clear_sqlmodel():
pytest.param("tutorial002_py310", marks=needs_py310),
pytest.param("tutorial002_an_py310", marks=needs_py310),
],
scope="module",
)
def get_client(request: pytest.FixtureRequest):
clear_sqlmodel()
@@ -44,6 +45,8 @@ def get_client(request: pytest.FixtureRequest):
# Clean up connection explicitly to avoid resource warning
mod.engine.dispose()
mod.engine.dispose()
def test_crud_app(client: TestClient):
# TODO: this warns that SQLModel.from_orm is deprecated in Pydantic v1, refactor