Skip to content

[pylint] Fix consider-using-sys-exit, use-yield-from, and implicit-str-concat #12379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion extra/get_issues.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
from pathlib import Path
import sys

import requests

Expand All @@ -17,7 +18,7 @@ def get_issues():
if r.status_code == 403:
# API request limit exceeded
print(data["message"])
exit(1)
sys.exit(1)
issues.extend(data)

# Look for next page
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ disable = [
"consider-using-from-import",
"consider-using-f-string",
"consider-using-in",
"consider-using-sys-exit",
"consider-using-ternary",
"consider-using-with",
"cyclic-import",
Expand All @@ -201,7 +200,6 @@ disable = [
"expression-not-assigned",
"fixme",
"global-statement",
"implicit-str-concat",
"import-error",
"import-outside-toplevel",
"inconsistent-return-statements",
Expand All @@ -212,10 +210,9 @@ disable = [
"keyword-arg-before-vararg",
"line-too-long",
"method-hidden",
"misplaced-bare-raise",
"missing-docstring",
"missing-timeout",
"multiple-statements",
"multiple-statements", # multiple-statements-on-one-line-colon (E701) from ruff
"no-else-break",
"no-else-continue",
"no-else-raise",
Expand Down
6 changes: 2 additions & 4 deletions src/_pytest/_py/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,13 @@
)
if not self.breadthfirst:
for subdir in dirs:
for p in self.gen(subdir):
yield p
yield from self.gen(subdir)

Check warning on line 164 in src/_pytest/_py/path.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/_py/path.py#L164

Added line #L164 was not covered by tests
for p in self.optsort(entries):
if self.fil is None or self.fil(p):
yield p
if self.breadthfirst:
for subdir in dirs:
for p in self.gen(subdir):
yield p
yield from self.gen(subdir)

Check warning on line 170 in src/_pytest/_py/path.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/_py/path.py#L170

Added line #L170 was not covered by tests


class FNMatcher:
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
# The default behavior of logging is to print "Logging error"
# to stderr with the call stack and some extra details.
# pytest wants to make such mistakes visible during testing.
raise
raise # pylint: disable=misplaced-bare-raise

Check warning on line 404 in src/_pytest/logging.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/logging.py#L404

Added line #L404 was not covered by tests


@final
Expand Down
2 changes: 1 addition & 1 deletion testing/_py/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_visit_norecurse(self, path1):

@pytest.mark.parametrize(
"fil",
["*dir", "*dir", pytest.mark.skip("sys.version_info <" " (3,6)")(b"*dir")],
["*dir", "*dir", pytest.mark.skip("sys.version_info < (3,6)")(b"*dir")],
)
def test_visit_filterfunc_is_string(self, path1, fil):
lst = []
Expand Down
2 changes: 1 addition & 1 deletion testing/test_cacheprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ def test_1(): assert 1
)

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

Expand Down
Loading