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

pytest.mark on TestCase affects base classes #1464

Closed
qwiglydee opened this issue Mar 18, 2016 · 1 comment
Closed

pytest.mark on TestCase affects base classes #1464

qwiglydee opened this issue Mar 18, 2016 · 1 comment

Comments

@qwiglydee
Copy link

When pytest.mark.skipif applied to a class with bases (mixins) the tests from base clases are disabled for all other testcases.

platform linux -- Python 3.4.3, pytest-2.9.0, py-1.4.30, pluggy-0.3.1

from unittest import TestCase
import pytest


class BaseMixin():
    def test_foo(self):
        True


@pytest.mark.skipif(True, reason="disabled")
class TestBar(BaseMixin, TestCase):
    def test_bar(self):
        True


class TestBaz(BaseMixin, TestCase):
    def test_baz(self):
        True

output:

collected 4 items 

tests.py::TestBar::test_bar SKIPPED
tests.py::TestBar::test_foo SKIPPED
tests.py::TestBaz::test_baz PASSED
tests.py::TestBaz::test_foo SKIPPED
=============================== 1 passed, 3 skipped in 0.04 seconds

The tests.py::TestBaz::test_foo was skipped because of mark at TestBar

@nicoddemus
Copy link
Member

Yep, it's a known issue... fixing it unfortunately is not so simple. 😬

See #631, #725, #568.

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

2 participants