python-restx / flask-restx

Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask
https://flask-restx.readthedocs.io/en/latest/
Other
2.14k stars 333 forks source link

fix: flask import of _endpoint_from_view_func - issue #567 #572

Closed Ryu-CZ closed 9 months ago

Ryu-CZ commented 11 months ago

Due to repeated accident of import error #567 I added helper method _import_check_viewfunc . With fallback to last known implementation which stayed the same in all flask versions.

I submit new pull request with new branch name flask-scaffold_567 on same commit, because in original pull request #568 I used master branch in contrary to guidelines.

peter-doggart commented 11 months ago

Thanks for doing this @Ryu-CZ

I'm assuming this is held up by the pytest-flask issue?

Ryu-CZ commented 11 months ago

@peter-doggart yes, tests are not passing because pytest-flask issue 167

Ryu-CZ commented 11 months ago

I forgot to add my method into utils.__all__ so here is small patch to fix it. This should prevent static syntax analyses to show weak warning about Importing method not listed in all.

peter-doggart commented 11 months ago

Still waiting on the pytest fixes, but it looks like they are working on getting that project updated. :)

codecov[bot] commented 10 months ago

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (3ea4ce1) 96.45% compared to head (81dd9f4) 96.15%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #572 +/- ## ========================================== - Coverage 96.45% 96.15% -0.30% ========================================== Files 20 20 Lines 2733 2755 +22 ========================================== + Hits 2636 2649 +13 - Misses 97 106 +9 ``` | [Files](https://app.codecov.io/gh/python-restx/flask-restx/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-restx) | Coverage Δ | | |---|---|---| | [flask\_restx/api.py](https://app.codecov.io/gh/python-restx/flask-restx/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-restx#diff-Zmxhc2tfcmVzdHgvYXBpLnB5) | `96.53% <100.00%> (-0.03%)` | :arrow_down: | | [flask\_restx/utils.py](https://app.codecov.io/gh/python-restx/flask-restx/pull/572?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-restx#diff-Zmxhc2tfcmVzdHgvdXRpbHMucHk=) | `83.87% <64.00%> (-13.43%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Ryu-CZ commented 10 months ago

I forget to mention the new method import_check_view_func to get _endpoint_from_view_func is compatible with flask reasonable versions 1, 2, 3.