pytest icon indicating copy to clipboard operation
pytest copied to clipboard

`pytest.param` raises `AttributeError` for a non-mark in `marks` (regression in 8.4)

Open aidxhxr opened this issue 3 weeks ago • 0 comments

Since 8.4.0, a non-mark in pytest.param(marks=...) fails with an internal AttributeError instead of the TypeError from 8.3:

import pytest

@pytest.mark.parametrize("x", [pytest.param(1, marks=["x"])])
def test_foo(x):
    pass
  • pytest 8.3.5: TypeError: got 'x' instead of Mark
  • pytest 8.4.0 to 9.2.0: AttributeError: 'str' object has no attribute 'name'

The usefixtures check added in #12828 (src/_pytest/mark/structures.py) reads .name before the marks are validated. I have a fix and will open a PR.

aidxhxr avatar Nov 08 '26 01:11 aidxhxr