Skip to content

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

Open

Description

@aidxhxr

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions