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

remove readonly properties #497

Merged
merged 9 commits into from
Mar 17, 2022

Conversation

beliaev-maksim
Copy link
Collaborator

currently we expose 2 attributes, users may think that changing them will affect something, but it is not
best example to show:

import responses

print(responses.assert_all_requests_are_fired)
responses.assert_all_requests_are_fired = True
print(responses.assert_all_requests_are_fired)
print(responses.mock.assert_all_requests_are_fired)

produces

False
True
False

@codecov
Copy link

codecov bot commented Feb 9, 2022

Codecov Report

Merging #497 (cb46489) into master (ce8a429) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #497   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines         2292      2305   +13     
=========================================
+ Hits          2292      2305   +13     
Impacted Files Coverage Δ
responses/__init__.py 100.00% <100.00%> (ø)
responses/tests/test_responses.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce8a429...cb46489. Read the comment docs.

@beliaev-maksim
Copy link
Collaborator Author

tests fail, #495 should fix it

@markstory
Copy link
Member

I'm concerned that we'll break user-land code by taking these away. Given the impacts of past clean up changes, we've seen that user-land code is using several internals (eg. _is_string). Perhaps we should add a property wrapper for these and emit deprecation warnings?

@beliaev-maksim
Copy link
Collaborator Author

also a valid argument

any ideas how to create a property without a class instance?
since now it is just a variable in the module, eg responses.assert_all_requests_are_fired

@aburgel
Copy link
Contributor

aburgel commented Feb 21, 2022

any ideas how to create a property without a class instance?

you can do something like this to deprecate these module attributes: https://www.python.org/dev/peps/pep-0562/

@beliaev-maksim
Copy link
Collaborator Author

any ideas how to create a property without a class instance?

you can do something like this to deprecate these module attributes: https://www.python.org/dev/peps/pep-0562/

Sounds like an idea, I will try it
Thanks

@beliaev-maksim
Copy link
Collaborator Author

@markstory
can you please review?

# Conflicts:
#	CHANGES
#	responses/__init__.py
@beliaev-maksim
Copy link
Collaborator Author

@markstory
merge conflicts are resolved

@markstory markstory merged commit 1724937 into getsentry:master Mar 17, 2022
@beliaev-maksim beliaev-maksim deleted the mbeliaev/properties branch March 17, 2022 16:16
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