Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding allow route overwrite option in blueprint #2716

Merged
merged 19 commits into from
Jul 7, 2023
Merged

Conversation

ChihweiLHBird
Copy link
Member

@ChihweiLHBird ChihweiLHBird commented Mar 19, 2023

closes #2554

@codecov
Copy link

codecov bot commented Mar 19, 2023

Codecov Report

Patch coverage: 100.000% and project coverage change: -0.044 ⚠️

Comparison is base (af67801) 88.938% compared to head (17471f1) 88.895%.

❗ Current head 17471f1 differs from pull request most recent head abe0657. Consider uploading reports for the commit abe0657 to get more accurate results

Additional details and impacted files
@@              Coverage Diff              @@
##              main     #2716       +/-   ##
=============================================
- Coverage   88.938%   88.895%   -0.044%     
=============================================
  Files           92        92               
  Lines         6952      6961        +9     
  Branches      1185      1188        +3     
=============================================
+ Hits          6183      6188        +5     
- Misses         527       529        +2     
- Partials       242       244        +2     
Impacted Files Coverage Δ
sanic/router.py 96.000% <ø> (ø)
sanic/app.py 90.119% <100.000%> (+0.016%) ⬆️
sanic/asgi.py 91.729% <100.000%> (+0.062%) ⬆️
sanic/blueprints.py 91.549% <100.000%> (+0.161%) ⬆️
sanic/mixins/routes.py 96.747% <100.000%> (+0.081%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@ahopkins ahopkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget a test 😎

@ahopkins
Copy link
Member

ahopkins commented Mar 20, 2023

@ChihweiLHBird Don't bother trying to keep it up to date and merging in latest (unless part of a local commit). It will likely change 10 more times before this is ready. I will make sure it is up to date when the time comes.

@ChihweiLHBird
Copy link
Member Author

@ahopkins Thanks! I added one test case for overwriting route after bp copy. It probably needs another test case for a non-copied blueprint to allow overwriting a route handler. Do you plan to include this PR in this release?

@ChihweiLHBird ChihweiLHBird marked this pull request as ready for review March 20, 2023 14:16
@ChihweiLHBird ChihweiLHBird requested a review from a team as a code owner March 20, 2023 14:16
@ChihweiLHBird ChihweiLHBird requested a review from a team as a code owner March 20, 2023 14:19
@ahopkins
Copy link
Member

Do you plan to include this PR in this release?

If its finished, yes.

1.py Outdated Show resolved Hide resolved
@ChihweiLHBird
Copy link
Member Author

ChihweiLHBird commented Mar 20, 2023

GitHub seems having a delay to sync branch with PR...

By the way, I try initializing a bp instance with overwriting route option set to True, and it seems it is not functioning well. I would prefer to postpone this to the next release instead of rushing it out.

@ChihweiLHBird ChihweiLHBird marked this pull request as draft March 20, 2023 14:25
@ahopkins
Copy link
Member

Works for me.

@ChihweiLHBird
Copy link
Member Author

@ahopkins Thanks!

@ChihweiLHBird ChihweiLHBird marked this pull request as ready for review April 25, 2023 06:35
tests/test_blueprints.py Outdated Show resolved Hide resolved
@ChihweiLHBird
Copy link
Member Author

We can consider to proceed with this PR if that's a better way to implement it.

@ChihweiLHBird ChihweiLHBird changed the title Adding Allow Route Overwrite Option in Blueprint Adding allow route overwrite option in blueprint Jul 6, 2023
@ahopkins ahopkins merged commit e374409 into main Jul 7, 2023
@ahopkins ahopkins deleted the zhiwei/route-overwrite branch July 7, 2023 11:56
moshe742 pushed a commit to moshe742/sanic that referenced this pull request Jul 8, 2023
* Adding allow route overwrite option

* Add test case for route overwriting after bp copy

* Fix test

* Fix

* Add test case `test_bp_allow_override`

* Remove conflicted future routes when overwriting is allowed

* Improved test test_bp_copy_with_route_overwriting

* Fix type

* Fix type 2

* Add `test_bp_copy_without_route_overwriting` case

* make `allow_route_overwrite` flag to be internal

* Remove unwanted test case

---------

Co-authored-by: Adam Hopkins <adam@amhopkins.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support overwriting a route of blueprint from copy
2 participants