-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
topic: marksrelated to marks, either the general marks or builtinrelated to marks, either the general marks or builtintype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
I don't know why, but I can't get the marker from my fixture. The request.node.get_marker() seems to return None regardless of the marker applied to class:
@pytest.fixture(scope='class')
def my_fixture(request):
marker = request.node.get_marker('joe') # Is always None
@pytest.mark.joe
class TestMarker(object):
def test_marker(self, my_fixture):
assert TrueI even registered the marker in my pytest.ini file:
# content of pytest.ini
[pytest]
markers =
joe: mark a test as joejoejoeIs this a bug or I'm missing something? Not to mention, I'm using 2.7.2 version.
Update 1:
If I get rid of the class and apply the marker to a function, it'll work:
@pytest.mark.joe
def test_marker(my_fixture):
assert TrueUpdate 2:
This actually works:
@pytest.fixture(scope='class')
def my_fixture(request):
marker = next((m for m in request.cls.pytestmark if m.name == 'joe'), None)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
topic: marksrelated to marks, either the general marks or builtinrelated to marks, either the general marks or builtintype: bugproblem that needs to be addressedproblem that needs to be addressed