forked from pool/python-pytest-flake8
* Update classifiers to indicate older versions are no longer supported
* No longer use deprecated pytest constructs
* Bump requirements to more accurately indicate what is currently needed
* Drop Python 2 support and dependency on py; from @erikkemperman
* Drop support for Python 3.5, 3.6
* Add a `flake8-max-doc-length` option; from @rodrigomologni
- Add patch support-flake8-5.patch:
* Support flake8 >= 5.0, adjust {Build,}Requires.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-flake8?expand=0&rev=12
51 lines
1.7 KiB
Diff
51 lines
1.7 KiB
Diff
From 976e6180201f7808a3007c8c5903a1637b18c0c8 Mon Sep 17 00:00:00 2001
|
|
From: Dominic Oram <dominic.oram@diamond.ac.uk>
|
|
Date: Fri, 5 Aug 2022 17:55:24 +0100
|
|
Subject: [PATCH] Update to work for flake8==5.0.0
|
|
|
|
---
|
|
pytest_flake8.py | 21 +++++++++++++--------
|
|
1 file changed, 13 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/pytest_flake8.py b/pytest_flake8.py
|
|
index 2555f8a..c693789 100644
|
|
--- a/pytest_flake8.py
|
|
+++ b/pytest_flake8.py
|
|
@@ -212,23 +212,28 @@ def check_file(path, flake8ignore, maxlength, maxdoclenght, maxcomplexity,
|
|
args += ['--show-source']
|
|
if statistics:
|
|
args += ['--statistics']
|
|
+ args += [str(path)]
|
|
app = application.Application()
|
|
prelim_opts, remaining_args = app.parse_preliminary_options(args)
|
|
- config_finder = config.ConfigFileFinder(
|
|
- app.program,
|
|
- prelim_opts.append_config,
|
|
- config_file=prelim_opts.config,
|
|
- ignore_config_files=prelim_opts.isolated,
|
|
+ cfg, cfg_dir = config.load_config(
|
|
+ config=prelim_opts.config,
|
|
+ extra=prelim_opts.append_config,
|
|
+ isolated=prelim_opts.isolated,
|
|
+ )
|
|
+ app.find_plugins(
|
|
+ cfg,
|
|
+ cfg_dir,
|
|
+ enable_extensions=prelim_opts.enable_extensions,
|
|
+ require_plugins=prelim_opts.require_plugins,
|
|
)
|
|
- app.find_plugins(config_finder)
|
|
app.register_plugin_options()
|
|
- app.parse_configuration_and_cli(config_finder, remaining_args)
|
|
+ app.parse_configuration_and_cli(cfg, cfg_dir, remaining_args)
|
|
if flake8ignore:
|
|
app.options.ignore = flake8ignore
|
|
app.make_formatter() # fix this
|
|
app.make_guide()
|
|
app.make_file_checker_manager()
|
|
- app.run_checks([str(path)])
|
|
+ app.run_checks()
|
|
app.formatter.start()
|
|
app.report_errors()
|
|
app.formatter.stop()
|