Skip to content

Commit 0ba3e91

Browse files
Merge pull request #12379 from Pierre-Sassoulas/more-pylint-fixes
[pylint] Fix ``consider-using-sys-exit``, ``use-yield-from``, and ``implicit-str-concat``
2 parents 383659d + 908e112 commit 0ba3e91

File tree

6 files changed

+8
-12
lines changed

6 files changed

+8
-12
lines changed

extra/get_issues.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
from pathlib import Path
3+
import sys
34

45
import requests
56

@@ -17,7 +18,7 @@ def get_issues():
1718
if r.status_code == 403:
1819
# API request limit exceeded
1920
print(data["message"])
20-
exit(1)
21+
sys.exit(1)
2122
issues.extend(data)
2223

2324
# Look for next page

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ disable = [
190190
"consider-using-from-import",
191191
"consider-using-f-string",
192192
"consider-using-in",
193-
"consider-using-sys-exit",
194193
"consider-using-ternary",
195194
"consider-using-with",
196195
"cyclic-import",
@@ -201,7 +200,6 @@ disable = [
201200
"expression-not-assigned",
202201
"fixme",
203202
"global-statement",
204-
"implicit-str-concat",
205203
"import-error",
206204
"import-outside-toplevel",
207205
"inconsistent-return-statements",
@@ -212,10 +210,9 @@ disable = [
212210
"keyword-arg-before-vararg",
213211
"line-too-long",
214212
"method-hidden",
215-
"misplaced-bare-raise",
216213
"missing-docstring",
217214
"missing-timeout",
218-
"multiple-statements",
215+
"multiple-statements", # multiple-statements-on-one-line-colon (E701) from ruff
219216
"no-else-break",
220217
"no-else-continue",
221218
"no-else-raise",

src/_pytest/_py/path.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,13 @@ def gen(self, path):
161161
)
162162
if not self.breadthfirst:
163163
for subdir in dirs:
164-
for p in self.gen(subdir):
165-
yield p
164+
yield from self.gen(subdir)
166165
for p in self.optsort(entries):
167166
if self.fil is None or self.fil(p):
168167
yield p
169168
if self.breadthfirst:
170169
for subdir in dirs:
171-
for p in self.gen(subdir):
172-
yield p
170+
yield from self.gen(subdir)
173171

174172

175173
class FNMatcher:

src/_pytest/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def handleError(self, record: logging.LogRecord) -> None:
401401
# The default behavior of logging is to print "Logging error"
402402
# to stderr with the call stack and some extra details.
403403
# pytest wants to make such mistakes visible during testing.
404-
raise
404+
raise # pylint: disable=misplaced-bare-raise
405405

406406

407407
@final

testing/_py/test_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def test_visit_norecurse(self, path1):
207207

208208
@pytest.mark.parametrize(
209209
"fil",
210-
["*dir", "*dir", pytest.mark.skip("sys.version_info <" " (3,6)")(b"*dir")],
210+
["*dir", "*dir", pytest.mark.skip("sys.version_info < (3,6)")(b"*dir")],
211211
)
212212
def test_visit_filterfunc_is_string(self, path1, fil):
213213
lst = []

testing/test_cacheprovider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ def test_1(): assert 1
11631163
)
11641164

11651165
p1.write_text(
1166-
"def test_1(): assert 1\n" "def test_2(): assert 1\n", encoding="utf-8"
1166+
"def test_1(): assert 1\ndef test_2(): assert 1\n", encoding="utf-8"
11671167
)
11681168
os.utime(p1, ns=(p1.stat().st_atime_ns, int(1e9)))
11691169

0 commit comments

Comments
 (0)