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 classmethod check for mixin case #618

Closed
wants to merge 2 commits into from

Conversation

adamchainz
Copy link
Member

I have a case of using a mixin on my test classes that started failing with 3.3.0 in upgrade PR adamchainz/django-mysql#484. It was caused by #598.

It looks like this was actually a latent failure in the way _classmethod_is_defined_at_leaf was picking the 'super method' - it would iterate further up the tree despite coming across the next method in the resolution chain. Also by not using __mro__ the order of the base classes wasn't strictly being observed, although I don't think that affects my mixin case.

Added a test that fails before and passes after.

I have a case of using a mixin on my test classes that started failing with 3.3.0 in upgrade PR adamchainz/django-mysql#484. It was caused by pytest-dev#598.

It looks like this was actually a latent failure in the way `_classmethod_is_defined_at_leaf` was picking the 'super method' - it would iterate further up the tree despite coming across the next method in the resolution chain. Also by not using `__mro__` the order of the base classes wasn't strictly being observed, although I don't think that affects my mixin case.

Added a test that fails before and passes after.
@codecov-io
Copy link

codecov-io commented Jun 17, 2018

Codecov Report

Merging #618 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #618      +/-   ##
==========================================
+ Coverage   92.28%   92.31%   +0.02%     
==========================================
  Files          32       32              
  Lines        1698     1704       +6     
  Branches      142      142              
==========================================
+ Hits         1567     1573       +6     
  Misses         94       94              
  Partials       37       37
Flag Coverage Δ
#dj110 84.38% <100%> (+0.05%) ⬆️
#dj111 86.5% <100%> (+0.04%) ⬆️
#dj18 85.09% <100%> (-0.07%) ⬇️
#dj19 84.27% <100%> (+0.05%) ⬆️
#dj20 84.68% <100%> (+0.05%) ⬆️
#dj21 84.68% <100%> (+0.05%) ⬆️
#djmaster 84.68% <100%> (+0.05%) ⬆️
#mysql_innodb 84.68% <100%> (+0.05%) ⬆️
#mysql_myisam 84.62% <100%> (+0.05%) ⬆️
#postgres 88.08% <100%> (+0.04%) ⬆️
#py27 89.67% <100%> (+0.03%) ⬆️
#py34 84.27% <100%> (+0.05%) ⬆️
#py35 84.38% <100%> (+0.05%) ⬆️
#py36 85.15% <100%> (+0.05%) ⬆️
#sqlite 86.5% <100%> (+0.04%) ⬆️
#sqlite_file 84.27% <100%> (+0.05%) ⬆️
Impacted Files Coverage Δ
tests/test_unittest.py 100% <100%> (ø) ⬆️
pytest_django/plugin.py 85.96% <100%> (+0.04%) ⬆️

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 ee878c2...07a03fa. Read the comment docs.

@blueyed
Copy link
Contributor

blueyed commented Jun 18, 2018

Thank you!
/cc @kleptog (via #598)

Copy link
Contributor

@blueyed blueyed left a comment

Choose a reason for hiding this comment

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

LGTM, pushed a fixup to ignore branch coverage with the for-loop.

@adamchainz
Copy link
Member Author

🍝

@blueyed blueyed closed this in 8a52643 Jun 18, 2018
beyondgeeks added a commit to beyondgeeks/django-pytest that referenced this pull request Sep 6, 2022
Fixes regression in #598.

It looks like this was actually a latent failure in the way
`_classmethod_is_defined_at_leaf` was picking the 'super method' - it
would iterate further up the tree despite coming across the next method
in the resolution chain. Also by not using `__mro__` the order of the
base classes wasn't strictly being observed, although I don't think that
affects my mixin case.

Added a test that fails before and passes after.

Closes pytest-dev/pytest-django#618.
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