[Pytest-commit] Issue #631: markers leaking (hpk42/pytest)
David Szotten
issues-reply at bitbucket.org
Tue Nov 11 15:48:06 CET 2014
New issue 631: markers leaking
https://bitbucket.org/hpk42/pytest/issue/631/markers-leaking
David Szotten:
it looks like using custom markers on subclasses, together with a fixture on the base class causes siblings to see each other's markers:
```
import pytest
@pytest.fixture
def common():
pass
@pytest.fixture
def checker(request):
assert len(request.keywords.get('marker').args) == 1
@pytest.mark.usefixtures('common')
class Parent(object):
pass
@pytest.mark.marker('arg1')
class TestChild1(Parent):
def test(self, checker):
pass
@pytest.mark.marker('arg2')
class TestChild2(Parent):
def test(self, checker):
pass
```
```
_________________________________________________ ERROR at setup of TestChild1.test _________________________________________________
request = <SubRequest 'checker' for <Function 'test'>>
@pytest.fixture
def checker(request):
> assert len(request.keywords.get('marker').args) == 1
E assert 2 == 1
E + where 2 = len(('arg1', 'arg2'))
E + where ('arg1', 'arg2') = <MarkInfo 'marker' args=('arg1', 'arg2') kwargs={}>.args
E + where <MarkInfo 'marker' args=('arg1', 'arg2') kwargs={}> = <bound method NodeKeywords.get of <NodeKeywords for node <Function 'test'>>>('marker')
E + where <bound method NodeKeywords.get of <NodeKeywords for node <Function 'test'>>> = <NodeKeywords for node <Function 'test'>>.get
E + where <NodeKeywords for node <Function 'test'>> = <SubRequest 'checker' for <Function 'test'>>.keywords
test_marker_bug.py:11: AssertionError
```
This might be related to #535
More information about the pytest-commit
mailing list