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

Make it compatible with latest flake8 #96

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

Et7f3
Copy link

@Et7f3 Et7f3 commented Apr 18, 2023

Fix #92 This make test passes. The modification was small and I have done atomic commit to explain the fix.

from this 1346ddefd315223b8f476bb02381a944e14f2cbc the semantic was to only allow errorcode
@Et7f3 Et7f3 changed the title Make it compatible with latest flake Make it compatible with latest flake8 Apr 18, 2023
Comment on lines -217 to -222
config_finder = config.ConfigFileFinder(
app.program,
prelim_opts.append_config,
config_file=prelim_opts.config,
ignore_config_files=prelim_opts.isolated,
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #88 the code is kept 🤔 but from the commit where they change they remove it.

if flake8ignore:
app.options.ignore = flake8ignore
app.make_formatter() # fix this
app.make_guide()
app.make_file_checker_manager()
app.make_file_checker_manager([])
app.run_checks([str(path)])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, correct me if I'm wrong because I'm not an expert. I am wondering how you know that run_checks() needs that one argument ([str(path)]), because in run_checks() is not other argument than self.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops I might have a wrong setup will retry

@kloczek
Copy link

kloczek commented Mar 15, 2024

I've tested this PR and looks like pytest still fails

Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-flake8-1.1.1-7.fc36.x86_64/usr/lib64/python3.9/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-flake8-1.1.1-7.fc36.x86_64/usr/lib/python3.9/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.9.18, pytest-8.1.1, pluggy-1.4.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-flake8-1.1.1
configfile: tox.ini
plugins: flake8-1.1.1, benchmark-4.0.0, aspectlib-2.0.0
collected 16 items

pytest_flake8.py F                                                                                                                                                                    [  6%]
setup.py F                                                                                                                                                                            [ 12%]
test_flake8.py F..FFFF.FFF.xF                                                                                                                                                         [100%]

[..]

================================================================================== short test summary info ==================================================================================
XFAIL test_flake8.py::test_strict - flake8 is not properly registered as a marker
FAILED pytest_flake8.py::flake-8::FLAKE8 - AttributeError: 'Application' object has no attribute 'parse_preliminary_options'
FAILED setup.py::flake-8::FLAKE8 - AttributeError: 'Application' object has no attribute 'parse_preliminary_options'
FAILED test_flake8.py::flake-8::FLAKE8 - AttributeError: 'Application' object has no attribute 'parse_preliminary_options'
FAILED test_flake8.py::TestIgnores::test_default_flake8_ignores - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}
FAILED test_flake8.py::TestIgnores::test_ignores_all - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}
FAILED test_flake8.py::TestIgnores::test_w293w292 - Failed: nomatch: '*W293*'
FAILED test_flake8.py::TestIgnores::test_mtime_caching - Failed: nomatch: '*W293*'
FAILED test_flake8.py::test_ok_verbose - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}
FAILED test_flake8.py::test_keyword_match - Failed: nomatch: '*E201*'
FAILED test_flake8.py::test_run_on_init_file - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}
FAILED test_flake8.py::test_junit_classname - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}
========================================================================== 11 failed, 4 passed, 1 xfailed in 3.18s ==========================================================================

Please let me know if you need full pytest output.

@Et7f3
Copy link
Author

Et7f3 commented Mar 17, 2024

I did the PR when latest pytest was 7.2.0 Have you tested with this version ? Or your tested with 8.1.1 ? At the time of my PR it allowed to have a more recent range of dependencies but maybe it need another PR to target latest (would prefer to have it merged if it improve the current status and maybe I will do another PR)

@kloczek
Copy link

kloczek commented Mar 17, 2024

I did the PR when latest pytest was 7.2.0 Have you tested with this version ?

Nope. I've tested that using latest pytest 8.1.1 😋

@j-rivero
Copy link

j-rivero commented Apr 2, 2024

As part of the works for the next Ubuntu Noble version under https://bugs.launchpad.net/ubuntu/+source/python-pytest-flake8/+bug/2058914 my teammate @clalancette made a path that I've verified can work with:

  • flake8 7.0.0-1 (probably any version above 6 could work)
  • pytest 7.4.4-1 and pytest 8.0.2-1

Patch against 1.1.1 is at 1.1.1...clalancette:pytest-flake8:modern-flake8

@jaraco
Copy link

jaraco commented Jul 19, 2024

Please consider contributing this fix or others to the revived project at coherent-oss.

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 this pull request may close these issues.

incompatible with pytest 7.2.0
5 participants