Skip to content

Commit

Permalink
test(api): local import get_openapi to avoid breaking all tests if …
Browse files Browse the repository at this point in the history
…FastAPI changes its API
  • Loading branch information
laurent-laporte-pro committed Dec 6, 2023
1 parent a9a2b9f commit fcf6a87
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/integration/test_apidoc.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from fastapi.openapi.utils import get_flat_models_from_routes
from fastapi.utils import get_model_definitions
from pydantic.schema import get_model_name_map
from starlette.testclient import TestClient

Check failure on line 1 in tests/integration/test_apidoc.py

View workflow job for this annotation

GitHub Actions / python-lint

Imports are incorrectly sorted and/or formatted.
from antarest import __version__


def test_apidoc(client: TestClient) -> None:
# Asserts that the apidoc can be loaded
flat_models = get_flat_models_from_routes(client.app.routes)
model_name_map = get_model_name_map(flat_models)
get_model_definitions(flat_models=flat_models, model_name_map=model_name_map)
# Local import to avoid breaking all tests if FastAPI changes its API
from fastapi.openapi.utils import get_openapi

routes = client.app.routes
openapi = get_openapi(title="Antares Web", version=__version__, routes=routes)
assert openapi

0 comments on commit fcf6a87

Please sign in to comment.