Skip to content

Commit 96101bb

Browse files
authored
Merge pull request #3 from githubjakob/feat/flask-openapi3
Feat/flask openapi3
2 parents 0dceb4e + 1364d01 commit 96101bb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/pytest_api_cov/frameworks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def get_framework_adapter(app: Any) -> BaseAdapter:
9595

9696
if module_name == "flask" and app_type == "Flask":
9797
return FlaskAdapter(app)
98-
if module_name == "fastapi" and app_type == "FastAPI":
98+
elif module_name == "flask_openapi3" and app_type == "OpenAPI":
99+
return FlaskAdapter(app)
100+
elif module_name == "fastapi" and app_type == "FastAPI":
99101
return FastAPIAdapter(app)
100102

101103
raise TypeError(f"Unsupported application type: {app_type}. pytest-api-coverage supports Flask and FastAPI.")

src/pytest_api_cov/plugin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ def is_supported_framework(app: Any) -> bool:
2424
app_type = type(app).__name__
2525
module_name = getattr(type(app), "__module__", "").split(".")[0]
2626

27-
return (module_name == "flask" and app_type == "Flask") or (module_name == "fastapi" and app_type == "FastAPI")
27+
return ((module_name == "flask" and app_type == "Flask") or
28+
(module_name == "flask_openapi3" and app_type == "OpenAPI") or
29+
(module_name == "fastapi" and app_type == "FastAPI"))
2830

2931

3032
def auto_discover_app() -> Optional[Any]:

0 commit comments

Comments
 (0)