Merge ~j-rivero/ubuntu/+source/python-pytest-flake8:ubuntu/devel into ubuntu/+source/python-pytest-flake8:ubuntu/devel

Proposed by Jose Luis Rivero
Status: Needs review
Proposed branch: ~j-rivero/ubuntu/+source/python-pytest-flake8:ubuntu/devel
Merge into: ubuntu/+source/python-pytest-flake8:ubuntu/devel
Diff against target: 193 lines (+100/-54)
5 files modified
debian/changelog (+7/-0)
debian/control (+3/-2)
debian/patches/flake8-7.x-pytest-greater-7.x.patch (+89/-0)
debian/patches/series (+1/-1)
dev/null (+0/-51)
Reviewer Review Type Date Requested Status
Ubuntu Sponsors Pending
git-ubuntu import Pending
Review via email: mp+464197@code.launchpad.net

Commit message

Patch to work with flake8 7.x series

Upstream is known to be broken with current flake8 version in noble:
https://github.com/tholo/pytest-flake8/pull/96.

To post a comment you must log in.

Unmerged commits

af54b25... by Jose Luis Rivero

Patch to work with flake8 7.x series

Upstream is known to be broken with new flake8 versions:
https://github.com/tholo/pytest-flake8/pull/96.

Signed-off-by: Jose Luis Rivero <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 76b5ef1..37462ba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
1python-pytest-flake8 (1.1.1-4ubuntu1) noble; urgency=medium
2
3 * Replace patch to work with flake8 version 7.x
4 (LP: #2058914)
5
6 -- Jose Luis Rivero <jrivero@osrfoundation.org> Fri, 12 Apr 2024 13:03:18 +0200
7
1python-pytest-flake8 (1.1.1-4) unstable; urgency=medium8python-pytest-flake8 (1.1.1-4) unstable; urgency=medium
29
3 * Team upload.10 * Team upload.
diff --git a/debian/control b/debian/control
index aea8951..1f6b2ac 100644
--- a/debian/control
+++ b/debian/control
@@ -1,11 +1,12 @@
1Source: python-pytest-flake81Source: python-pytest-flake8
2Section: python2Section: python
3Priority: optional3Priority: optional
4Maintainer: Debian Python Team <team+python@tracker.debian.org>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5XSBC-Original-Maintainer: Debian Python Team <team+python@tracker.debian.org>
5Uploaders: Sergio Durigan Junior <sergiodj@debian.org>6Uploaders: Sergio Durigan Junior <sergiodj@debian.org>
6Build-Depends: debhelper-compat (= 13),7Build-Depends: debhelper-compat (= 13),
7 dh-python,8 dh-python,
8 python3-flake8 (>= 5.0.4),9 python3-flake8 (>= 7.0.0),
9 python3-pytest <!nocheck>,10 python3-pytest <!nocheck>,
10 python3-py <!nocheck>,11 python3-py <!nocheck>,
11 python3-setuptools,12 python3-setuptools,
diff --git a/debian/patches/flake8-5.x-support.patch b/debian/patches/flake8-5.x-support.patch
12deleted file mode 10064413deleted file mode 100644
index fd743dd..0000000
--- a/debian/patches/flake8-5.x-support.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1From 976e6180201f7808a3007c8c5903a1637b18c0c8 Mon Sep 17 00:00:00 2001
2From: Dominic Oram <dominic.oram@diamond.ac.uk>
3Date: Fri, 5 Aug 2022 17:55:24 +0100
4Subject: [PATCH] Update to work for flake8==5.0.0
5Origin: https://github.com/tholo/pytest-flake8/pull/88
6
7---
8 pytest_flake8.py | 21 +++++++++++++--------
9 1 file changed, 13 insertions(+), 8 deletions(-)
10
11diff --git a/pytest_flake8.py b/pytest_flake8.py
12index 2555f8a..c693789 100644
13--- a/pytest_flake8.py
14+++ b/pytest_flake8.py
15@@ -212,23 +212,28 @@ def check_file(path, flake8ignore, maxlength, maxdoclenght, maxcomplexity,
16 args += ['--show-source']
17 if statistics:
18 args += ['--statistics']
19+ args += [str(path)]
20 app = application.Application()
21 prelim_opts, remaining_args = app.parse_preliminary_options(args)
22- config_finder = config.ConfigFileFinder(
23- app.program,
24- prelim_opts.append_config,
25- config_file=prelim_opts.config,
26- ignore_config_files=prelim_opts.isolated,
27+ cfg, cfg_dir = config.load_config(
28+ config=prelim_opts.config,
29+ extra=prelim_opts.append_config,
30+ isolated=prelim_opts.isolated,
31+ )
32+ app.find_plugins(
33+ cfg,
34+ cfg_dir,
35+ enable_extensions=prelim_opts.enable_extensions,
36+ require_plugins=prelim_opts.require_plugins,
37 )
38- app.find_plugins(config_finder)
39 app.register_plugin_options()
40- app.parse_configuration_and_cli(config_finder, remaining_args)
41+ app.parse_configuration_and_cli(cfg, cfg_dir, remaining_args)
42 if flake8ignore:
43 app.options.ignore = flake8ignore
44 app.make_formatter() # fix this
45 app.make_guide()
46 app.make_file_checker_manager()
47- app.run_checks([str(path)])
48+ app.run_checks()
49 app.formatter.start()
50 app.report_errors()
51 app.formatter.stop()
diff --git a/debian/patches/flake8-7.x-pytest-greater-7.x.patch b/debian/patches/flake8-7.x-pytest-greater-7.x.patch
52new file mode 1006440new file mode 100644
index 0000000..86dbae2
--- /dev/null
+++ b/debian/patches/flake8-7.x-pytest-greater-7.x.patch
@@ -0,0 +1,89 @@
1Description: Patch to work with flake8 7.x series
2 Upstream is known to be broken with new flake8 versions:
3 https://github.com/tholo/pytest-flake8/pull/96. Patch is part of the
4 discussion in the PR but upstream does not seem very responsive.
5Author: clalancette@intrinsic.ai
6Reviewed-by: jrivero@osrfoundation.org
7Bug: https://github.com/tholo/pytest-flake8/pull/96#issuecomment-2032433686
8Origin: https://github.com/clalancette/pytest-flake8/commits/modern-flake8/
9Last-Update: 2024-04-02
10
11diff --git a/pytest_flake8.py b/pytest_flake8.py
12index 2555f8a..254b8b5 100644
13--- a/pytest_flake8.py
14+++ b/pytest_flake8.py
15@@ -6,7 +6,7 @@
16 from io import BytesIO, TextIOWrapper
17
18 from flake8.main import application
19-from flake8.options import config
20+from flake8.options.parse_args import parse_args
21
22 import pytest
23
24@@ -213,22 +213,14 @@ def check_file(path, flake8ignore, maxlength, maxdoclenght, maxcomplexity,
25 if statistics:
26 args += ['--statistics']
27 app = application.Application()
28- prelim_opts, remaining_args = app.parse_preliminary_options(args)
29- config_finder = config.ConfigFileFinder(
30- app.program,
31- prelim_opts.append_config,
32- config_file=prelim_opts.config,
33- ignore_config_files=prelim_opts.isolated,
34- )
35- app.find_plugins(config_finder)
36- app.register_plugin_options()
37- app.parse_configuration_and_cli(config_finder, remaining_args)
38+ app.plugins, app.options = parse_args(args)
39 if flake8ignore:
40 app.options.ignore = flake8ignore
41 app.make_formatter() # fix this
42 app.make_guide()
43- app.make_file_checker_manager()
44- app.run_checks([str(path)])
45+ app.make_file_checker_manager([])
46+ app.options.filenames = [str(path)]
47+ app.run_checks()
48 app.formatter.start()
49 app.report_errors()
50 app.formatter.stop()
51diff --git a/test_flake8.py b/test_flake8.py
52index 0bc2461..e70860f 100644
53--- a/test_flake8.py
54+++ b/test_flake8.py
55@@ -2,7 +2,6 @@
56 """Unit tests for flake8 pytest plugin."""
57 from __future__ import print_function
58
59-import py
60 import pytest
61
62 pytest_plugins = "pytester",
63@@ -44,8 +43,8 @@ def test_default_flake8_ignores(self, testdir):
64
65 [flake8]
66 ignore = E203
67- *.py E300
68- tests/*.py ALL E203 # something
69+ E300
70+ ALL E203
71 """)
72 testdir.tmpdir.ensure("xy.py")
73 testdir.tmpdir.ensure("tests/hello.py")
74@@ -164,13 +163,13 @@ def test_unicode_error(testdir):
75 x = testdir.tmpdir.join("x.py")
76 import codecs
77 f = codecs.open(str(x), "w", encoding="utf8")
78- f.write(py.builtin._totext("""
79+ f.write("""
80 # coding=utf8
81
82 accent_map = {
83 u'\\xc0': 'a', # À -> a non-ascii comment crashes it
84 }
85-""", "utf8"))
86+""")
87 f.close()
88 # result = testdir.runpytest("--flake8", x, "-s")
89 # result.stdout.fnmatch_lines("*non-ascii comment*")
diff --git a/debian/patches/series b/debian/patches/series
index f977d3c..3617b63 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
1flake8-5.x-support.patch1flake8-7.x-pytest-greater-7.x.patch

Subscribers

People subscribed via source and target branches