-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytopic: marksrelated to marks, either the general marks or builtinrelated to marks, either the general marks or builtintopic: selectionrelated to test selection from the command linerelated to test selection from the command linetype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
If multiple test classes all subclass a class with shared tests and use the pytest.mark.usefixtures(), runs using -k SingleClass will still invoke excluded test class sourced fixtures.
reproduce.py
import pytest
@pytest.fixture
def one():
print 'In one!'
@pytest.fixture
def two():
print 'In two!'
@pytest.fixture
def three():
print 'In three!'
class Base(object):
def test_shared(self):
assert 1
@pytest.mark.usefixtures('one')
class TestOne(Base):
def test_one(self):
assert 1
@pytest.mark.usefixtures('two')
class TestTwo(Base):
def test_two(self):
assert 1
@pytest.mark.usefixtures('three')
class TestThree(Base):
def test_three(self):
assert 1OSX:tmp me$ pytest -vs reproduce.py -k Three
======================================================================== test session starts =========================================================================
platform darwin -- Python 2.7.13, pytest-3.2.2, py-1.4.34, pluggy-0.4.0 -- /Users/me/.virtualenvs/venv/bin/python2.7
cachedir: .cache
metadata: {'Python': '2.7.13', 'Platform': 'Darwin-15.5.0-x86_64-i386-64bit', 'Packages': {'py': '1.4.34', 'pytest': '3.2.2', 'pluggy': '0.4.0'}, 'Plugins': {'pylama': '7.4.1', 'cov': '2.5.1', 'ordering': '0.5', 'html': '1.15.2', 'catchlog': '1.2.2', 'instafail': '0.3.0', 'metadata': '1.5.0'}}
rootdir: /Users/me/tmp, inifile:
plugins: ordering-0.5, metadata-1.5.0, instafail-0.3.0, html-1.15.2, cov-2.5.1, catchlog-1.2.2, pylama-7.4.1
reproduce.py::TestThree::test_shared In one!
In two!
In three!
PASSED
reproduce.py::TestThree::test_three In three!
PASSED
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytopic: marksrelated to marks, either the general marks or builtinrelated to marks, either the general marks or builtintopic: selectionrelated to test selection from the command linerelated to test selection from the command linetype: bugproblem that needs to be addressedproblem that needs to be addressed