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

move unbound_send outside of the function #648

Merged
merged 7 commits into from
Jul 12, 2023

Conversation

beliaev-maksim
Copy link
Collaborator

Moving unbound_on_send outside of the function will allow users to override the method if they will need to without a need to rewrite the entire start method

@codecov
Copy link

codecov bot commented Jun 24, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (c25a1c8) 100.00% compared to head (fd371e5) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #648   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines         2872      2874    +2     
=========================================
+ Hits          2872      2874    +2     
Impacted Files Coverage Δ
responses/__init__.py 100.00% <100.00%> (ø)

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

responses/__init__.py Outdated Show resolved Hide resolved
@markstory
Copy link
Member

Moving unbound_on_send outside of the function will allow users to override the method if they will need to without a need to rewrite the entire start method

Is there a use case for overwriting this method and behavior?

@beliaev-maksim
Copy link
Collaborator Author

@markstory while working on the bug for moto I spotted that we always use the same _real_send. However, there might be a use case where we will use unbound_on_send in a nested responses mock as a real adapter.
then user can intercept real send from a mock (eg in moto) and override it with responses.unbound_on_send

a bit hard to explain.
here is more info and examples: getmoto/moto#6417

@beliaev-maksim
Copy link
Collaborator Author

but generally, it will not hard. Since this produces a cleaner way to handle methods within class and provides more granular control

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.

3 participants