tholo / pytest-flake8

pytest plugin to run flake8
Other
117 stars 47 forks source link

DeprecationWarning generated under latest pytest #63

Closed jwodder closed 4 years ago

jwodder commented 4 years ago

As of the release of pytest 5.4.0 earlier today, attempting to run pytest with pytest-flake8 installed and with [pytest]filterwarnings set to error causes the run to fail immediately with:

.tox/py36/lib/python3.6/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
.tox/py36/lib/python3.6/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
.tox/py36/lib/python3.6/site-packages/pluggy/manager.py:87: in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
.tox/py36/lib/python3.6/site-packages/pytest_flake8.py:72: in pytest_collect_file   
    statistics=config._flake8statistics)
.tox/py36/lib/python3.6/site-packages/_pytest/nodes.py:83: in __call__
    warnings.warn(NODE_USE_FROM_PARENT.format(name=self.__name__), stacklevel=2)
E   pytest.PytestDeprecationWarning: direct construction of Flake8Item has been deprecated, please use Flake8Item.from_parent

This is due to the deprecation of direct constructors for Nodes; see item 5975 under "Deprecations" in the release notes for pytest 5.4.0. pytest-flake8 thus needs to be updated; according to the release notes:

Subclasses are expected to use super().from_parent if they intend to expand the creation of Nodes.

duckinator commented 4 years ago

Related issues/PRs:

Workaround: pin pytest to 5.3.5.