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

markers leaking #631

Closed
pytestbot opened this issue Nov 11, 2014 · 1 comment
Closed

markers leaking #631

pytestbot opened this issue Nov 11, 2014 · 1 comment
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: David Szotten (BitBucket: davidszotten, GitHub: davidszotten)


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


@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
@nicoddemus
Copy link
Member

Duplicate of #568

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

3 participants