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
Lukas Märdian (community) Abstain
Andreas Hasenack Needs Resubmitting
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.
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

While this MP was up for review, noble was released and oracular opened. If the intention is to continue with an SRU for noble, then the current merge target should be changed to ubuntu/noble-devel.

review: Needs Resubmitting
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This does not prevent a first pass review, which I'm doing.

My first comment is, besides the resubmitting against ubuntu/noble-devel, to break up your changes in several commits. Here is what I would expect to see:
- commit for d/changelog
- commit for update-maintainer on d/control
- commit for the build-deps change in d/control
- commit dropping d/p/flake8-5.x-support.patch and removing it from d/p/series
- commit adding debian/patches/flake8-7.x-pytest-greater-7.x.patch and the corresponding d/p/series update

Maybe the last two could be done in one commit, I don't have a hard preference there.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Comments inline, all about the DEP3 header actually. I know this patch landed as is in Debian, and also now in Oracular, but for an upcoming SRU, we can tidy it up a bit.

Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Jose Luis Rivero (j-rivero) wrote :

Thanks Andreas. I don't have the time anymore to work on the SRU anymore for this package so I'm orphaning the work here for Noble. Just in case that someone wants to follow it up.

Revision history for this message
Lukas Märdian (slyon) wrote :
review: Abstain

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
1diff --git a/debian/changelog b/debian/changelog
2index 76b5ef1..37462ba 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+python-pytest-flake8 (1.1.1-4ubuntu1) noble; urgency=medium
7+
8+ * Replace patch to work with flake8 version 7.x
9+ (LP: #2058914)
10+
11+ -- Jose Luis Rivero <jrivero@osrfoundation.org> Fri, 12 Apr 2024 13:03:18 +0200
12+
13 python-pytest-flake8 (1.1.1-4) unstable; urgency=medium
14
15 * Team upload.
16diff --git a/debian/control b/debian/control
17index aea8951..1f6b2ac 100644
18--- a/debian/control
19+++ b/debian/control
20@@ -1,11 +1,12 @@
21 Source: python-pytest-flake8
22 Section: python
23 Priority: optional
24-Maintainer: Debian Python Team <team+python@tracker.debian.org>
25+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
26+XSBC-Original-Maintainer: Debian Python Team <team+python@tracker.debian.org>
27 Uploaders: Sergio Durigan Junior <sergiodj@debian.org>
28 Build-Depends: debhelper-compat (= 13),
29 dh-python,
30- python3-flake8 (>= 5.0.4),
31+ python3-flake8 (>= 7.0.0),
32 python3-pytest <!nocheck>,
33 python3-py <!nocheck>,
34 python3-setuptools,
35diff --git a/debian/patches/flake8-5.x-support.patch b/debian/patches/flake8-5.x-support.patch
36deleted file mode 100644
37index fd743dd..0000000
38--- a/debian/patches/flake8-5.x-support.patch
39+++ /dev/null
40@@ -1,51 +0,0 @@
41-From 976e6180201f7808a3007c8c5903a1637b18c0c8 Mon Sep 17 00:00:00 2001
42-From: Dominic Oram <dominic.oram@diamond.ac.uk>
43-Date: Fri, 5 Aug 2022 17:55:24 +0100
44-Subject: [PATCH] Update to work for flake8==5.0.0
45-Origin: https://github.com/tholo/pytest-flake8/pull/88
46-
47----
48- pytest_flake8.py | 21 +++++++++++++--------
49- 1 file changed, 13 insertions(+), 8 deletions(-)
50-
51-diff --git a/pytest_flake8.py b/pytest_flake8.py
52-index 2555f8a..c693789 100644
53---- a/pytest_flake8.py
54-+++ b/pytest_flake8.py
55-@@ -212,23 +212,28 @@ def check_file(path, flake8ignore, maxlength, maxdoclenght, maxcomplexity,
56- args += ['--show-source']
57- if statistics:
58- args += ['--statistics']
59-+ args += [str(path)]
60- app = application.Application()
61- prelim_opts, remaining_args = app.parse_preliminary_options(args)
62-- config_finder = config.ConfigFileFinder(
63-- app.program,
64-- prelim_opts.append_config,
65-- config_file=prelim_opts.config,
66-- ignore_config_files=prelim_opts.isolated,
67-+ cfg, cfg_dir = config.load_config(
68-+ config=prelim_opts.config,
69-+ extra=prelim_opts.append_config,
70-+ isolated=prelim_opts.isolated,
71-+ )
72-+ app.find_plugins(
73-+ cfg,
74-+ cfg_dir,
75-+ enable_extensions=prelim_opts.enable_extensions,
76-+ require_plugins=prelim_opts.require_plugins,
77- )
78-- app.find_plugins(config_finder)
79- app.register_plugin_options()
80-- app.parse_configuration_and_cli(config_finder, remaining_args)
81-+ app.parse_configuration_and_cli(cfg, cfg_dir, remaining_args)
82- if flake8ignore:
83- app.options.ignore = flake8ignore
84- app.make_formatter() # fix this
85- app.make_guide()
86- app.make_file_checker_manager()
87-- app.run_checks([str(path)])
88-+ app.run_checks()
89- app.formatter.start()
90- app.report_errors()
91- app.formatter.stop()
92diff --git a/debian/patches/flake8-7.x-pytest-greater-7.x.patch b/debian/patches/flake8-7.x-pytest-greater-7.x.patch
93new file mode 100644
94index 0000000..86dbae2
95--- /dev/null
96+++ b/debian/patches/flake8-7.x-pytest-greater-7.x.patch
97@@ -0,0 +1,89 @@
98+Description: Patch to work with flake8 7.x series
99+ Upstream is known to be broken with new flake8 versions:
100+ https://github.com/tholo/pytest-flake8/pull/96. Patch is part of the
101+ discussion in the PR but upstream does not seem very responsive.
102+Author: clalancette@intrinsic.ai
103+Reviewed-by: jrivero@osrfoundation.org
104+Bug: https://github.com/tholo/pytest-flake8/pull/96#issuecomment-2032433686
105+Origin: https://github.com/clalancette/pytest-flake8/commits/modern-flake8/
106+Last-Update: 2024-04-02
107+
108+diff --git a/pytest_flake8.py b/pytest_flake8.py
109+index 2555f8a..254b8b5 100644
110+--- a/pytest_flake8.py
111++++ b/pytest_flake8.py
112+@@ -6,7 +6,7 @@
113+ from io import BytesIO, TextIOWrapper
114+
115+ from flake8.main import application
116+-from flake8.options import config
117++from flake8.options.parse_args import parse_args
118+
119+ import pytest
120+
121+@@ -213,22 +213,14 @@ def check_file(path, flake8ignore, maxlength, maxdoclenght, maxcomplexity,
122+ if statistics:
123+ args += ['--statistics']
124+ app = application.Application()
125+- prelim_opts, remaining_args = app.parse_preliminary_options(args)
126+- config_finder = config.ConfigFileFinder(
127+- app.program,
128+- prelim_opts.append_config,
129+- config_file=prelim_opts.config,
130+- ignore_config_files=prelim_opts.isolated,
131+- )
132+- app.find_plugins(config_finder)
133+- app.register_plugin_options()
134+- app.parse_configuration_and_cli(config_finder, remaining_args)
135++ app.plugins, app.options = parse_args(args)
136+ if flake8ignore:
137+ app.options.ignore = flake8ignore
138+ app.make_formatter() # fix this
139+ app.make_guide()
140+- app.make_file_checker_manager()
141+- app.run_checks([str(path)])
142++ app.make_file_checker_manager([])
143++ app.options.filenames = [str(path)]
144++ app.run_checks()
145+ app.formatter.start()
146+ app.report_errors()
147+ app.formatter.stop()
148+diff --git a/test_flake8.py b/test_flake8.py
149+index 0bc2461..e70860f 100644
150+--- a/test_flake8.py
151++++ b/test_flake8.py
152+@@ -2,7 +2,6 @@
153+ """Unit tests for flake8 pytest plugin."""
154+ from __future__ import print_function
155+
156+-import py
157+ import pytest
158+
159+ pytest_plugins = "pytester",
160+@@ -44,8 +43,8 @@ def test_default_flake8_ignores(self, testdir):
161+
162+ [flake8]
163+ ignore = E203
164+- *.py E300
165+- tests/*.py ALL E203 # something
166++ E300
167++ ALL E203
168+ """)
169+ testdir.tmpdir.ensure("xy.py")
170+ testdir.tmpdir.ensure("tests/hello.py")
171+@@ -164,13 +163,13 @@ def test_unicode_error(testdir):
172+ x = testdir.tmpdir.join("x.py")
173+ import codecs
174+ f = codecs.open(str(x), "w", encoding="utf8")
175+- f.write(py.builtin._totext("""
176++ f.write("""
177+ # coding=utf8
178+
179+ accent_map = {
180+ u'\\xc0': 'a', # À -> a non-ascii comment crashes it
181+ }
182+-""", "utf8"))
183++""")
184+ f.close()
185+ # result = testdir.runpytest("--flake8", x, "-s")
186+ # result.stdout.fnmatch_lines("*non-ascii comment*")
187diff --git a/debian/patches/series b/debian/patches/series
188index f977d3c..3617b63 100644
189--- a/debian/patches/series
190+++ b/debian/patches/series
191@@ -1 +1 @@
192-flake8-5.x-support.patch
193+flake8-7.x-pytest-greater-7.x.patch

Subscribers

People subscribed via source and target branches