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

fix(spy): use classmethod __func__ source for async detection #148

Merged
merged 3 commits into from
Dec 22, 2022

Conversation

mcous
Copy link
Owner

@mcous mcous commented Dec 22, 2022

Closes #146. Similarly to how we handle staticmethod, this PR gets the .__func__ attribute of a classmethod to use at a Spy's source specification, which works around a bug (?) in Python where inspect.iscoroutinefunction returns False on Python <3.10 for async @classmethod functions.

This PR also drops Python 3.6 from the CI matrix due to GitHub dropping it from the ubuntu-latest runner since it EOL'd. Python 3.6 support is not officially dropped from Decoy (which I would put behind a major version bump) but ensuring proper behavior on 3.6 will be harder moving forward

@codecov
Copy link

codecov bot commented Dec 22, 2022

Codecov Report

Merging #148 (3b7f921) into main (ce5c8e8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #148   +/-   ##
=======================================
  Coverage   98.36%   98.36%           
=======================================
  Files          19       19           
  Lines         734      736    +2     
  Branches      121      122    +1     
=======================================
+ Hits          722      724    +2     
  Misses         10       10           
  Partials        2        2           
Impacted Files Coverage Δ
decoy/spy_core.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@mcous mcous changed the title fix(spy): use classmethod func source for async detection fix(spy): use classmethod __func__ source for async detection Dec 22, 2022
@mcous mcous merged commit 0dfc38c into main Dec 22, 2022
@mcous mcous deleted the fix-async-classmethod branch December 22, 2022 18:02
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.

Rehearsing an async classmethod raises TypeError
1 participant