typeddjango / pytest-mypy-plugins

pytest plugin for testing mypy types, stubs, and plugins
https://pypi.org/project/pytest-mypy-plugins/
MIT License
100 stars 26 forks source link

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

Open tlambert03 opened 6 months ago

tlambert03 commented 6 months ago
_______________________________________________ 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.
sobolevn commented 6 months ago

PR is welcome :)

tlambert03 commented 6 months ago

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