File tree Expand file tree Collapse file tree 5 files changed +25
-27
lines changed
Expand file tree Collapse file tree 5 files changed +25
-27
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ pytest plugin for efficiently checking PEP8 compliance
2424Usage
2525-----
2626
27- Install it into a test environment, then run tests with the option::
27+ Install it into a test environment, then run tests with the option.
28+
29+ .. code-block :: bash
2830
2931 pytest --flake8
3032
@@ -60,7 +62,16 @@ All the Flake8 tests are skipping!
6062
6163By design, results are cached and only changed files are checked.
6264
63- Run with ``pytest --cache-clear --flake8 `` to bypass.
65+ To bypass this caching mechanism, run the following command:
66+
67+ .. code-block :: bash
68+
69+ pytest --cache-clear --flake8
70+
71+ Run tests with [tox](https://tox.wiki) (e.g. `pipx run tox `).
72+
73+ For more information, take a look at the `skeleton <https://blog.jaraco.com/skeleton/ >`_.
74+
6475
6576Notes
6677-----
Original file line number Diff line number Diff line change 1+ Compatible for Flake8 from version ``flake8>=4 ``.
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ classifiers = [
2424]
2525requires-python = " >=3.9"
2626dependencies = [
27- " flake8 >= 5, < 6 " ,
27+ " flake8 >= 4.0 " ,
2828 " pytest >= 7.0" ,
2929]
3030dynamic = [" version" ]
Original file line number Diff line number Diff line change 66from io import BytesIO , TextIOWrapper
77
88from flake8 .main import application
9- from flake8 .options import config
109
1110import pytest
1211
@@ -226,29 +225,9 @@ def check_file(
226225 args += ['--show-source' ]
227226 if statistics :
228227 args += ['--statistics' ]
229- args += [str (path )]
230228 app = application .Application ()
231- prelim_opts , remaining_args = app .parse_preliminary_options (args )
232- cfg , cfg_dir = config .load_config (
233- config = prelim_opts .config ,
234- extra = prelim_opts .append_config ,
235- isolated = prelim_opts .isolated ,
236- )
237- app .find_plugins (
238- cfg ,
239- cfg_dir ,
240- enable_extensions = prelim_opts .enable_extensions ,
241- require_plugins = prelim_opts .require_plugins ,
242- )
243- app .register_plugin_options ()
244- app .parse_configuration_and_cli (cfg , cfg_dir , remaining_args )
245229 if flake8ignore :
246- app .options .ignore = flake8ignore
247- app .make_formatter () # fix this
248- app .make_guide ()
249- app .make_file_checker_manager ()
250- app .run_checks ()
251- app .formatter .start ()
252- app .report_errors ()
253- app .formatter .stop ()
230+ args += ["--ignore" , flake8ignore ]
231+ args += [str (path )]
232+ app .run (args )
254233 return app .result_count
Original file line number Diff line number Diff line change 22
33import pathlib
44import textwrap
5+ from packaging import version
56
67import pytest
78
9+ from flake8 import __version__ as flake8_version
10+
811pytest_plugins = ("pytester" ,)
912
1013
@@ -39,6 +42,10 @@ def test_ignores(self, tmpdir):
3942 assert ign (tmpdir .join ("a/y.py" )) == "E203 E300" .split ()
4043 assert ign (tmpdir .join ("a/z.py" )) is None
4144
45+ @pytest .mark .xfail (
46+ version .parse (flake8_version ) >= version .parse ("6.0.0" ),
47+ reason = "Requires Flake8 version earlier than 6.0.0." ,
48+ )
4249 def test_default_flake8_ignores (self , testdir ):
4350 testdir .makeini ("""
4451 [pytest]
You can’t perform that action at this time.
0 commit comments