Skip to content

New deprecation warning with pytest 8.1 (YamlTestFile not using a cooperative constructor) #142

Open
@tlambert03

Description

@tlambert03
_______________________________________________ ERROR collecting typesafety ________________________________________________
.venv/lib/python3.12/site-packages/_pytest/nodes.py:87: in _create
    return super().__call__(*k, **kw)  # type: ignore[no-any-return,misc]
E   TypeError: FSCollector.__init__() got an unexpected keyword argument 'fspath'

During handling of the above exception, another exception occurred:
.venv/lib/python3.12/site-packages/pluggy/_hooks.py:501: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.venv/lib/python3.12/site-packages/pluggy/_manager.py:119: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.venv/lib/python3.12/site-packages/pytest_mypy_plugins/collect.py:181: in pytest_collect_file
    return YamlTestFile.from_parent(parent, path=file_path, fspath=None)
.venv/lib/python3.12/site-packages/_pytest/nodes.py:592: in from_parent
    return super().from_parent(parent=parent, path=path, **kw)
.venv/lib/python3.12/site-packages/_pytest/nodes.py:203: in from_parent
    return cls._create(parent=parent, **kw)
.venv/lib/python3.12/site-packages/_pytest/nodes.py:93: in _create
    warnings.warn(
E   pytest.PytestDeprecationWarning: <class 'pytest_mypy_plugins.collect.YamlTestFile'> is not using a cooperative constructor and only takes {'parent', 'path'}.
E   See https://docs.pytest.org/en/stable/deprecations.html#constructors-of-custom-pytest-node-subclasses-should-take-kwargs for more details.

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