Open GenevieveBuckley opened 1 year ago
Suggestion from https://github.com/dask/dask-image/pull/306#discussion_r1152641096
Maybe FlakeHell is a better option? This blogpost seems encouraging: https://dev.to/bowmanjd/using-flake8-and-pyproject-toml-with-flakehell-1cn1
Oh yeah, flake8 shows quite some problems when invoked explicitely!
Not sure about setup.py
, but since you're working on migrating to pyproject.toml: It seems that indicating the addopts in an entry [tool.pytest.ini_options] instead of [tool.pytest] does the trick. It works for me locally. Found here
Regarding the flake8 related failures themselves, it seems they're coming from the pytest plugin pytest-flake8
: https://stackoverflow.com/questions/61743089/python-testing-with-flake8-and-pytest-results-in-attributeerror-application-o.
Actually, the pytest-flake8
project seems to be unmaintained: https://github.com/pypi/support/issues/2587.
Maybe FlakeHell is a better option? This blogpost seems encouraging: https://dev.to/bowmanjd/using-flake8-and-pyproject-toml-with-flakehell-1cn1
Looks like the project was archived and this fork is active https://flakeheaven.readthedocs.io/en/latest/
I'm very unexperienced here 😁. What would be the advantage of using flakeheaven instead of flake8 directly? Is it that flakeheaven can be configured in pyproject.toml? Flake8 could be configured in its own config file.
Also, what would it mean to decouple the linting from testing, that additional steps would need to be added to the github actions configuration? Locally for contributors I've seen that we're already suggesting to explicitely call flake8 in CONTRIBUTING.rst.
There are two problems:
Describe the issue: We have
--flake8
as a pytestaddopts
extra:...which I think is equivalent to the command line call
But when I run just
pytest
from the command line, it doesn't seem to pick up the extra addopts bit. All the tests pass with justpytest
, but there are failures when I runpytest --flake8
explicitly.Minimal Complete Verifiable Example:
pytest
, and observe the tests passing.pytest --flake8
(which should be equivalent to the above, given we are using addopts "--flake8"), but this time observe some tests failing due to flake8.Details (click to expand):
``` _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x1052391e0> hook_name = 'pytest_runtest_call' methods = [Anything else we need to know?:
I've noticed the same problem in https://github.com/dask/dask-image/pull/306
I might have done something silly by adding a separate
pytest.ini
file in https://github.com/dask/dask-image/pull/151, which might override or conflict with the pytest section insetup.cfg
. So this might have masked the problem for a while, but since I see the same problems with the new pyrpoject.toml configuration (https://github.com/dask/dask-image/pull/306) that can't explain everything.Environment:
conda list (click to expand):
``` # Name Version Build Channel appnope 0.1.3 pyhd8ed1ab_0 conda-forge asttokens 2.2.1 pyhd8ed1ab_0 conda-forge attrs 22.2.0 pypi_0 pypi backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 pyhd8ed1ab_3 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge bzip2 1.0.8 h3422bc3_4 conda-forge ca-certificates 2022.12.7 h4653dfc_0 conda-forge click 8.1.3 pypi_0 pypi cloudpickle 2.2.1 pypi_0 pypi dask 2023.3.2 pypi_0 pypi dask-image 2022.9.0+30.gb08d494 dev_0