Repository navigation
fix: --sharpit-app reports an uninspectable app as unknown, not as an empty pass - #276
Merged
Merged
Conversation
Signed-off-by: Michael Egner <m.egner@gmx.net> (cherry picked from commit 7195b81)
Signed-off-by: Michael Egner <m.egner@gmx.net> (cherry picked from commit c9b0a28)
Signed-off-by: Michael Egner <m.egner@gmx.net> (cherry picked from commit f2be6a7)
Signed-off-by: Michael Egner <m.egner@gmx.net> (cherry picked from commit b9384ea)
Signed-off-by: Michael Egner <m.egner@gmx.net> (cherry picked from commit 779a4d7)
…test imports its module Signed-off-by: Michael Egner <m.egner@gmx.net> (cherry picked from commit daeb733)
…s annotations Signed-off-by: Michael Egner <m.egner@gmx.net> (cherry picked from commit d1149bc)
…changelog Signed-off-by: Michael Egner <m.egner@gmx.net> (cherry picked from commit d7da7e3)
Signed-off-by: Michael Egner <m.egner@gmx.net> (cherry picked from commit d02ac08)
The two entries sat under 0.7.0; the fix ships in 0.8.0. Contributed by @michaelegner (#207). Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
…sed, not reported uninspectable Signed-off-by: Flavio Oliva <ffroliva@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Carries #207 by @michaelegner onto
release/0.8.0.--sharpit-appon an object whose routes cannot be read (a WSGIapp, an app wrapped in middleware, a coroutine returned by an async factory) now reports the API model as UNKNOWN,
with a masked reason, instead of an empty
PASSED. An explicit FastAPI or Starlette app with no routes stays aconfirmed empty pass, and an
APIRouteris no longer called as a factory.-x; authorship and sign-offs are kept.pytest_plugin/apps.pyconflicted with the Flask handling added in 0.8.0. The resolution keeps the Flask path: theuninspectable check runs only for non-Flask apps,
load_appnever calls a Flask app, and an explicit Flask app withan unreadable URL map keeps its own reason.
Supersedes #207, which is closed once this pull request merges.
Tests
The tests from #207 fail on
release/0.8.0without the fix (9 behaviour tests, for exampletest_sharpit_app_uninspectable_app_fails_the_run_by_defaultandtest_sharpit_app_router_is_assessed). A new test,test_explicit_flask_app_with_a_route_map_is_assessed_not_uninspectable, fails with the Flask guard removed andpasses with it. The pytest plugin, FastAPI introspector and Flask tests pass, as do ruff, format, pyright and the
import-boundary, code-shape and citation checks.