pytest-mypy-plugins icon indicating copy to clipboard operation
pytest-mypy-plugins copied to clipboard

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

Open tlambert03 opened this issue 2 years ago • 2 comments

_______________________________________________ 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.

tlambert03 avatar Mar 04 '24 13:03 tlambert03

PR is welcome :)

sobolevn avatar Mar 04 '24 14:03 sobolevn

will do if I have time! I don't know the first thing about this sort of pytest plugin :) was reporting as a courtesy. it's definitely not a big deal (i can silence the warnings locally).

tlambert03 avatar Mar 04 '24 14:03 tlambert03