Skip to content

marker expressions use the legacy mark storage #3441

Closed
@Botje

Description

@Botje

I am currently chasing an issue which is very similar to the (apparently solved) #568 and the not yet solved #2947. I was happy to discover pull request #3317 and switched to the features branch to see if my issue had been fixed.
Unfortunately, it is not..

Given test_bug.py:

import pytest

class BaseTests(object):
    def test_something(self):
        pass

@pytest.mark.FOO
class TestFooClass(BaseTests):
    pass

@pytest.mark.BAR
class TestBarClass(BaseTests):
    pass

I expect pytest --collect_only -m FOO test_bug.py to return only TestFooClass::()::test_something.
However, I get back methods from both subclasses:

$ pytest --collect-only -m "FOO" test_bug.py
================================================================================= test session starts ==================================================================================
platform linux -- Python 3.6.3, pytest-3.5.2.dev80+g7834b450, py-1.5.3, pluggy-0.6.0
rootdir: /home/barco/pytest-bug, inifile:
collected 2 items
<Module 'test_bug.py'>
  <Class 'TestFooClass'>
    <Instance '()'>
      <Function 'test_something'>
  <Class 'TestBarClass'>
    <Instance '()'>
      <Function 'test_something'>

If I reverse the order of TestFooClass and TestBarClass, I get two hits for BAR instead.

My environment is Ubuntu Linux 17.10 with python 3.6.3, in a fresh virtualenv with only pytest@features installed.
Output of pip list:

Package        Version
-------------- ---------------------
atomicwrites   1.1.5
attrs          17.4.0
more-itertools 4.1.0
pip            10.0.1
pkg-resources  0.0.0
pluggy         0.6.0
py             1.5.3
pytest         3.5.2.dev80+g7834b450
setuptools     39.1.0
six            1.11.0
wheel          0.31.0

Thanks for your time and please let me know if I can provide further information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: marksrelated to marks, either the general marks or builtintype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions