Add patch support-pytest-9.patch

Support pytest 9 changes.
This commit is contained in:
2025-12-16 12:45:11 +11:00
parent de9fd95329
commit fb1e2c05e6
3 changed files with 47 additions and 2 deletions

View File

@@ -1,4 +1,6 @@
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Dec 15 23:28:43 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com> Tue Dec 16 01:44:24 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Initial release of 1.3.0. - Initial release of 1.3.0.
- Add patch support-pytest-9.patch:
* Support pytest 9 changes.

View File

@@ -19,10 +19,11 @@
Name: python-pytest-flake8 Name: python-pytest-flake8
Version: 1.3.0 Version: 1.3.0
Release: 0 Release: 0
Summary: pytest plugin to check FLAKE8 requirements Summary: Pytest plugin to check flake8 requirements
License: MIT License: MIT
URL: https://github.com/coherent-oss/pytest-flake8 URL: https://github.com/coherent-oss/pytest-flake8
Source: https://files.pythonhosted.org/packages/source/p/pytest-flake8/pytest_flake8-1.3.0.tar.gz Source: https://files.pythonhosted.org/packages/source/p/pytest-flake8/pytest_flake8-1.3.0.tar.gz
Patch0: support-pytest-9.patch
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
BuildRequires: %{python_module pip} BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools >= 61.2} BuildRequires: %{python_module setuptools >= 61.2}

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)