tholo / pytest-flake8

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

Usage no longer compatible with pytest 7 #83

Open jaraco opened 2 years ago

jaraco commented 2 years ago

See https://github.com/pytest-dev/pytest/issues/8435 for background and https://github.com/jaraco/pytest-checkdocs/pull/9 for an example of how I addressed the issue in pytest-checkdocs.

jaraco commented 2 years ago

See jaraco/pytest-checkdocs#9 and jaraco/pytest-perf#5 for approaches I used to fix this issue.

abravalheri commented 2 years ago

The following warning/error also shows up with 7.0.1:

E   pytest.PytestWarning: Flake8Item is an Item subclass and should not be a collector, however its bases File are collectors.
E   Please split the Collectors and the Item into separate node types.
E   Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html
E   example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/
akaihola commented 2 years ago

With pytest-flake8==1.1.0 and pytest==7.0.0 I used to get these:

_pytest/nodes.py:146
  _pytest/nodes.py:146: PytestDeprecationWarning: <class 'pytest_flake8.Flake8Item'> is not using a cooperative constructor and only takes {'fspath', 'parent'}.
  See https://docs.pytest.org/en/stable/deprecations.html#constructors-of-custom-pytest-node-subclasses-should-take-kwargs for more details.
    warnings.warn(

_pytest/nodes.py:686
  _pytest/nodes.py:686: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to Flake8Item is deprecated. Please use the (path: pathlib.Path) argument instead.
  See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
    super().__init__(

After upgrading to pytest==7.1.1, I additionally see this one:

_pytest/nodes.py:708
  _pytest/nodes.py:708: PytestWarning: Flake8Item is an Item subclass and should not be a collector, however its bases File are collectors.
  Please split the Collectors and the Item into separate node types.
  Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html
  example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/
    warnings.warn(

But after upgrading to pytest-flake8==1.1.1 they all disappear.

Should this PR be closed, or are there some other remaining incompatibilities with Pytest 7.x which I'm just not hitting in my project?