getsentry / responses

A utility for mocking out the Python Requests library.
Apache License 2.0
4.08k stars 347 forks source link

Fix/calllist typing #690

Closed howamith closed 8 months ago

howamith commented 8 months ago

Typing for the CallList class was improved in 0.23.0 (see #593), however this has regressed in 0.24.0 - I believe through the changes made in #684. This PR reintroduces the improved typing from #593.

I've tried to add a test to ensure this doesn't happen again, however it's currently evergreen as mypy isn't run on the tests. (IMHO mypy - and any other static analysis tools - should be run against the tests. Type hints are great and their use should be encouraged, however by not checking the tests there's nothing checking how these types work from the perspective of the code consuming this package - which is probably how this was missed in #684.)

I did have a brief go at running mypy over the tests to give the new test a bit more purpose (and to improve coverage generally), but there were 754 errors so that feels like something that should be addressed in its own PR.