Skip to content

Tavern Marks Broken with Pytest 7.3.0 #859

@bramwelt

Description

@bramwelt

Pytest's most recent release of 7.3.0 removes their reliance on the external attrs package. This package is used for custom marks and the following kinds of errors are reported when ran with it:

/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/tavern/_core/pytest/file.py:361: in collect
    for i in self._generate_items(test_spec):
/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/tavern/_core/pytest/file.py:336: in _generate_items
    item.add_markers(pytest_marks)
/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/tavern/_core/pytest/item.py:127: in add_markers
    new_mark = attr.evolve(pm.mark, args=pm.mark.args[0])
/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/attr/_funcs.py:357: in evolve
    attrs = fields(cls)
/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/attr/_make.py:1923: in fields
    raise NotAnAttrsClassError(f"{cls!r} is not an attrs-decorated class.")
E   attr.exceptions.NotAnAttrsClassError: <class '_pytest.mark.structures.Mark'> is not an attrs-decorated class.
------------------------------- Captured stderr --------------------------------
/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/tavern/_core/pytest/file.py:62: PytestUnknownMarkWarning: Unknown pytest.mark.zoom - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
  pytest_marks.append(getattr(pytest.mark, m))

Including attrs in dependencies isn't enough to fix the issue. Restricting pytest<7.3.0 is currently the only fix I've found.

Can Tavern be updated to work with the newest version of pytest?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions