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

Problem with setUpClass #280

Closed
MikeVL opened this issue Oct 6, 2015 · 3 comments
Closed

Problem with setUpClass #280

MikeVL opened this issue Oct 6, 2015 · 3 comments

Comments

@MikeVL
Copy link

MikeVL commented Oct 6, 2015

My test code is:

class MarketFixtures(object):
    fixtures = [
        'tests/fixtures/common_rubricator.json',
    ]

class MarketOfferPictureTestCase(MarketFixtures, TestCase):
    ...

Raised with error

/usr/local/lib/python2.7/dist-packages/pytest_django/plugin.py:301: in pytest_runtest_setup
    _disable_class_methods(cls)
/usr/local/lib/python2.7/dist-packages/pytest_django/plugin.py:266: in _disable_class_methods
    _method_is_defined_at_leaf(cls, 'setUpClass'),
/usr/local/lib/python2.7/dist-packages/pytest_django/plugin.py:254: in _method_is_defined_at_leaf
    return getattr(cls.__base__, method_name).__func__ is not getattr(cls, method_name).__func__
E   AttributeError: type object 'MarketFixtures' has no attribute 'setUpClass'
@blueyed
Copy link
Contributor

blueyed commented Oct 6, 2015

Also a problem with tests from django-autocomplete-light: https://travis-ci.org/yourlabs/django-autocomplete-light/jobs/83851177

@pelme
Copy link
Member

pelme commented Oct 6, 2015

Seems easy to reproduce, will try to push a fix and 2.9.1 release soon!

pelme added a commit to pelme/pytest-django that referenced this issue Oct 6, 2015
The previous fix did not properly check the full MRO chain when looking
for the super method, which then failed when used with mixins that does
not define setUpClass/tearDownClass.

This commit fixes issue pytest-dev#280.
@pelme pelme mentioned this issue Oct 6, 2015
pelme added a commit that referenced this issue Oct 6, 2015
The previous fix did not properly check the full MRO chain when looking
for the super method, which then failed when used with mixins that does
not define setUpClass/tearDownClass.

This commit fixes issue #280.
@pelme
Copy link
Member

pelme commented Oct 6, 2015

This is now fixed in master, and released in 2.9.1 on PyPI!

@pelme pelme closed this as completed Oct 6, 2015
tomviner pushed a commit to tomviner/pytest-django that referenced this issue Jun 22, 2016
The previous fix did not properly check the full MRO chain when looking
for the super method, which then failed when used with mixins that does
not define setUpClass/tearDownClass.

This commit fixes issue pytest-dev#280.
mfa pushed a commit to aexeagmbh/pytest-django that referenced this issue May 17, 2017
The previous fix did not properly check the full MRO chain when looking
for the super method, which then failed when used with mixins that does
not define setUpClass/tearDownClass.

This commit fixes issue pytest-dev#280.
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

No branches or pull requests

3 participants