File tree 5 files changed +25
-27
lines changed
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
24
24
Usage
25
25
-----
26
26
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
28
30
29
31
pytest --flake8
30
32
@@ -60,7 +62,16 @@ All the Flake8 tests are skipping!
60
62
61
63
By design, results are cached and only changed files are checked.
62
64
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
+
64
75
65
76
Notes
66
77
-----
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 = [
24
24
]
25
25
requires-python = " >=3.9"
26
26
dependencies = [
27
- " flake8 >= 5, < 6 " ,
27
+ " flake8 >= 4.0 " ,
28
28
" pytest >= 7.0" ,
29
29
]
30
30
dynamic = [" version" ]
Original file line number Diff line number Diff line change 6
6
from io import BytesIO , TextIOWrapper
7
7
8
8
from flake8 .main import application
9
- from flake8 .options import config
10
9
11
10
import pytest
12
11
@@ -226,29 +225,9 @@ def check_file(
226
225
args += ['--show-source' ]
227
226
if statistics :
228
227
args += ['--statistics' ]
229
- args += [str (path )]
230
228
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 )
245
229
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 )
254
233
return app .result_count
Original file line number Diff line number Diff line change 2
2
3
3
import pathlib
4
4
import textwrap
5
+ from packaging import version
5
6
6
7
import pytest
7
8
9
+ from flake8 import __version__ as flake8_version
10
+
8
11
pytest_plugins = ("pytester" ,)
9
12
10
13
@@ -39,6 +42,10 @@ def test_ignores(self, tmpdir):
39
42
assert ign (tmpdir .join ("a/y.py" )) == "E203 E300" .split ()
40
43
assert ign (tmpdir .join ("a/z.py" )) is None
41
44
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
+ )
42
49
def test_default_flake8_ignores (self , testdir ):
43
50
testdir .makeini ("""
44
51
[pytest]
You can’t perform that action at this time.
0 commit comments