We are currently using pytest-flake8, which runs flake8 code style checks within pytest. But it has turned out to be fragile (see PR #598 and tholo/pytest-flake8#87) and many projects are switching to a setup where flake8 is run separately (see pypa/pyproject-hooks#147 , pytest-dev/pytest#9217 (comment), miketheman/pytest-socket#82 )
We should also consider doing this. At the moment it is not possible to use the recently released flake8 version 5 because it's not compatible with pytest-flake8 1.1.1, so we have for now pinned flake8 to version 4 in #598, but this is not a good long term solution.