Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Deprecations in pytest==7.0.0 make tests fail #3079

Closed
abravalheri opened this issue Feb 4, 2022 · 6 comments
Closed

[CI] Deprecations in pytest==7.0.0 make tests fail #3079

abravalheri opened this issue Feb 4, 2022 · 6 comments

Comments

@abravalheri
Copy link
Contributor

Pytest 7 that just came out a few hours ago is currently issuing a deprecation warning for pytest-flake8, which makes setuptools tests to fail:

$ tox
...
...
E   pytest.PytestDeprecationWarning: <class 'pytest_flake8.Flake8Item'> is not using a cooperative constructor and only takes {'fspath', 'parent'}.
E   See https://docs.pytest.org/en/stable/deprecations.html#constructors-of-custom-pytest-node-subclasses-should-take-kwargs for more details.
...
...
E   pytest.PytestRemovedIn8Warning: The (fspath: py.path.local) argument to Flake8Item is deprecated. Please use the (path: pathlib.Path) argument instead.
E   See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path

This problem seems to be already reported in the project issue tracker: tholo/pytest-flake8#83.

As a temporary workaround I believe we can take one of the following approaches:

  1. Ignore those specific warnings in pytest.ini
  2. Disable temporarily pytest-flake8
  3. Add a version cap to the pytest test dependency.

Probably the first approach is the most straight forward?

@abravalheri
Copy link
Contributor Author

abravalheri commented Feb 4, 2022

This issue also seems to apply to pytest-perf:

.tox/python/lib/python3.8/site-packages/pytest_perf/plugin.py:21: in pytest_collect_file
    return File.from_parent(parent, fspath=path)
...
E   pytest.PytestRemovedIn8Warning: The (fspath: py.path.local) argument to File is deprecated. Please use the (path: pathlib.Path) argument instead.
E   See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path

@abravalheri abravalheri changed the title [CI] Problems with pytest-flake8 and pytest==7.0.0 [CI] Deprecations in pytest==7.0.0 make tests fail Feb 4, 2022
tsibley added a commit to nextstrain/cli that referenced this issue Feb 4, 2022
The warning was turned into an error by our pytest config, and thus
resulted in test failures.

There's an existing issue for pytest-flake8¹ that's 3 months old now
with no movement so far.  setuptools is also dealing with the same
warnings.²

If other issues arise that aren't fixed upstream, a longer term solution
could be doing what we do with mypy and simply invoke flake8 directly
instead of via a pytest plugin.

¹ tholo/pytest-flake8#83
² pypa/setuptools#3079
@jaraco
Copy link
Member

jaraco commented Feb 5, 2022

This issue probably affects every project based on jaraco/skeleton. Maybe it would be best to address it there.

@jaraco
Copy link
Member

jaraco commented Feb 5, 2022

The issue also affects pytest-black and pytest-mypy, but those are still disabled on this project. It may also affect pytest-checkdocs. Confirmed pytest-checkdocs is not affected.

@jaraco
Copy link
Member

jaraco commented Feb 5, 2022

Reported the issue to jaraco/skeleton#57.

@jaraco
Copy link
Member

jaraco commented Feb 5, 2022

Merged as 8c0228f.

@jaraco jaraco closed this as completed Feb 5, 2022
@jaraco
Copy link
Member

jaraco commented Feb 5, 2022

I'm addressing a follow-up issue in pytest-dev/pytest#9616.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants