- Update to 1.3.0

* Compatible for Flake8 from version flake8>=4. (#4)
  * Pin to flake8<6 as it's incompatible. (#2)
  * Remove reference to py.builtin in tests. (#2)
  * Disabled the 'enabler' plugin when running tests. (#2)
  * Declare minimum flake8 as v5. (#1)
  * Adopted jaraco/skeleton for packaging.
- Add patch support-pytest-9.patch:
  * Support pytest 9 changes.
- Drop patch support-flake8-5.patch, no longer required.
- Use pyproject macros.
- Update URL to its new home and License.
This commit is contained in:
2026-01-22 16:37:19 +11:00
parent cc3b7924f7
commit 64f7900a03
6 changed files with 94 additions and 75 deletions

Binary file not shown.

BIN
pytest_flake8-1.3.0.tar.gz LFS Normal file

Binary file not shown.

View File

@@ -1,3 +1,19 @@
-------------------------------------------------------------------
Thu Jan 22 05:37:08 UTC 2026 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 1.3.0:
* Compatible for Flake8 from version flake8>=4. (#4)
* Pin to flake8<6 as it's incompatible. (#2)
* Remove reference to py.builtin in tests. (#2)
* Disabled the 'enabler' plugin when running tests. (#2)
* Declare minimum flake8 as v5. (#1)
* Adopted jaraco/skeleton for packaging.
- Add patch support-pytest-9.patch:
* Support pytest 9 changes.
- Drop patch support-flake8-5.patch, no longer required.
- Use pyproject macros.
- Update URL to its new home and License.
-------------------------------------------------------------------
Wed Nov 30 08:29:38 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-pytest-flake8
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2026 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,37 +17,48 @@
Name: python-pytest-flake8
Version: 1.1.1
Version: 1.3.0
Release: 0
Summary: Plugin for pytest to check FLAKE8 requirements
License: BSD-2-Clause
URL: https://github.com/tholo/pytest-flake8
Source: https://files.pythonhosted.org/packages/source/p/pytest-flake8/pytest-flake8-%{version}.tar.gz
# PATCH-FIX-UPSTREAM Support flake8 >= 5.0 gh#tholo/pytest-flake8#88
Patch0: support-flake8-5.patch
BuildRequires: %{python_module flake8 >= 5.0}
BuildRequires: %{python_module pytest >= 3.5}
BuildRequires: %{python_module py}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
License: MIT
URL: https://github.com/coherent-oss/pytest-flake8
Source: https://files.pythonhosted.org/packages/source/p/pytest-flake8/pytest_flake8-%{version}.tar.gz
Patch0: support-pytest-9.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools >= 61.2}
BuildRequires: %{python_module setuptools_scm >= 3.4.1}
BuildRequires: python-rpm-macros
Requires: python-flake8 >= 5.0
Requires: python-py
Requires: python-pytest >= 3.5
# SECTION test requirements
BuildRequires: %{python_module flake8 >= 4.0}
BuildRequires: %{python_module pytest >= 7.0}
# /SECTION
BuildRequires: fdupes
Requires: python-flake8 >= 4.0
Requires: python-pytest >= 7.0
Suggests: python-sphinx >= 3.5
Suggests: python-jaraco.packaging >= 9.3
Suggests: python-rst.linker >= 1.9
Suggests: python-furo
Suggests: python-sphinx-lint
Suggests: python-pytest-checkdocs >= 2.4
Suggests: python-pytest-ruff >= 0.2.1
Suggests: python-pytest-cov
Suggests: python-pytest-enabler >= 2.2
Suggests: python-pytest-mypy
BuildArch: noarch
%python_subpackages
%description
Plugin for py.test for efficiently checking PEP8 compliance.
Plugin for pytest for efficiently checking PEP8 compliance.
%prep
%autosetup -p1 -n pytest-flake8-%{version}
%autosetup -p1 -n pytest_flake8-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
@@ -55,9 +66,9 @@ Plugin for py.test for efficiently checking PEP8 compliance.
%files %{python_files}
%license LICENSE
%doc CHANGELOG README.rst
%pycache_only %{python_sitelib}/__pycache__/*.pyc
%doc README.rst
%{python_sitelib}/pytest_flake8.py
%{python_sitelib}/pytest_flake8-%{version}*-info
%pycache_only %{python_sitelib}/__pycache__/pytest_flake8*.pyc
%{python_sitelib}/pytest_flake8-%{version}.dist-info
%changelog

View File

@@ -1,50 +0,0 @@
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()

42
support-pytest-9.patch Normal file
View File

@@ -0,0 +1,42 @@
Sourced from https://github.com/OpenIndiana/oi-userland/pull/19860/commits/0d06abedf17256d1f2c89086acc05cfa53dbc647
https://github.com/coherent-oss/pytest-flake8/issues/5
--- pytest_flake8-1.3.0/pytest_flake8.py.orig
+++ pytest_flake8-1.3.0/pytest_flake8.py
@@ -4,6 +4,7 @@
import re
from contextlib import redirect_stdout, redirect_stderr
from io import BytesIO, TextIOWrapper
+from fnmatch import fnmatch
from flake8.main import application
@@ -59,11 +60,11 @@
config._flake8mtimes = config.cache.get(HISTKEY, {})
-def pytest_collect_file(file_path, path, parent):
+def pytest_collect_file(file_path, parent):
"""Filter files down to which ones should be checked."""
config = parent.config
if config.option.flake8 and file_path.suffix in config._flake8exts:
- flake8ignore = config._flake8ignore(path)
+ flake8ignore = config._flake8ignore(file_path)
if flake8ignore is not None:
item = Flake8File.from_parent(
parent,
@@ -203,7 +204,12 @@
def __call__(self, path):
l = [] # noqa: E741
for glob, ignlist in self.ignores:
- if not glob or path.fnmatch(glob):
+ mpath = path
+ if glob and '/' in glob:
+ glob = "*" + glob
+ else:
+ mpath = str(path).split("/")[-1]
+ if not glob or fnmatch(mpath, glob):
if ignlist is None:
return None
l.extend(ignlist)