Skip to content

request.node.get_closest_marker('name') returns None for markers applied in modules #11701

@8TRobi8

Description

@8TRobi8
  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

Description

As mentioned in the title, I cannot send marker value to fixtures with 'module' scope.
I've found something similar, where the 'class' scope was fixed: #902

Minimal example

@pytest.fixture(scope="module")
def foo(request):
   marker = request.node.get_closest_marker("fixt_data")
   if marker is None:
      data = None
   else:
      data = marker.args[0]
   return data

@pytest.mark.fixt_data("C1")
def test_fixt(foo):
    assert fixt == C1

Pip list

Package Version


certifi 2023.11.17
charset-normalizer 3.3.2
docker 7.0.0
exceptiongroup 1.2.0
idna 3.6
iniconfig 2.0.0
Jinja2 3.1.2
junit2html 30.1.3
MarkupSafe 2.1.3
packaging 23.2
paho-mqtt 1.6.1
pip 22.3.1
pluggy 1.3.0
pytest 7.4.3
pytest-docker-fixtures 1.3.18
pytest-html 4.1.1
pytest-metadata 3.0.0
pytest-mqtt 0.3.1
requests 2.31.0
setuptools 65.6.3
tomli 2.0.1
urllib3 2.1.0

Versions

pytest - 7.4.3
MacOS - Sonoma 14.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: marksrelated to marks, either the general marks or builtin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions