Skip to content

Commit 01ae286

Browse files
committed
Update Ruff
1 parent 0c0a9b5 commit 01ae286

File tree

7 files changed

+13
-15
lines changed

7 files changed

+13
-15
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: v0.12.11
7+
rev: v0.13.0
88
hooks:
99
- id: ruff-check
1010
args: [--fix, --exit-non-zero-on-fix]

src/structlog/stdlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def findCaller(
130130
This logger gets set as the default one when using LoggerFactory.
131131
"""
132132
sinfo: str | None
133-
f, name = _find_first_app_frame_and_name(["logging"])
133+
f, _name = _find_first_app_frame_and_name(["logging"])
134134
sinfo = _format_stack(f) if stack_info else None
135135

136136
return f.f_code.co_filename, f.f_lineno, f.f_code.co_name, sinfo

tests/processors/test_renderers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,7 @@ def test_disallows_non_utc_unix_timestamps(self):
377377
A asking for a UNIX timestamp with a timezone that's not UTC raises a
378378
ValueError.
379379
"""
380-
with pytest.raises(
381-
ValueError, match="UNIX timestamps are always UTC."
382-
):
380+
with pytest.raises(ValueError, match="UNIX timestamps are always UTC"):
383381
TimeStamper(utc=False)
384382

385383
def test_inserts_utc_unix_timestamp_by_default(self):

tests/test_dev.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ def test_enforces_presence_of_exactly_one_default_formatter(self):
602602

603603
with pytest.raises(
604604
ValueError,
605-
match="Only one default column formatter allowed.",
605+
match="Only one default column formatter allowed",
606606
):
607607
dev.ConsoleRenderer(
608608
columns=[
@@ -657,7 +657,7 @@ def test_rich_traceback_formatter_no_rich():
657657
"""
658658
with pytest.raises(
659659
ModuleNotFoundError,
660-
match="RichTracebackFormatter requires Rich to be installed.",
660+
match="RichTracebackFormatter requires Rich to be installed",
661661
):
662662
dev.rich_traceback(StringIO(), sys.exc_info())
663663

tests/test_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_pickle_not_stdout_stderr(self, logger_cls, tmpdir, proto):
102102
f.write("")
103103
pl = logger_cls(file=f.open())
104104

105-
with pytest.raises(pickle.PicklingError, match="Only (.+)Loggers to"):
105+
with pytest.raises(pickle.PicklingError, match=r"Only (.+)Loggers to"):
106106
pickle.dumps(pl, proto)
107107

108108
def test_deepcopy(self, logger_cls, capsys):

tests/test_stdlib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_deduces_correct_caller(self):
117117
"""
118118
logger = _FixedFindCallerLogger("test")
119119

120-
file_name, line_number, func_name = logger.findCaller()[:3]
120+
file_name, _line_number, func_name = logger.findCaller()[:3]
121121

122122
assert file_name == os.path.realpath(__file__)
123123
assert func_name == "test_deduces_correct_caller"
@@ -127,7 +127,7 @@ def test_stack_info(self):
127127
If we ask for stack_info, it will returned.
128128
"""
129129
logger = _FixedFindCallerLogger("test")
130-
testing, is_, fun, stack_info = logger.findCaller(stack_info=True)
130+
testing, is_, fun, stack_info = logger.findCaller(stack_info=True) # noqa: RUF059
131131

132132
assert "testing, is_, fun" in stack_info
133133

@@ -136,7 +136,7 @@ def test_no_stack_info_by_default(self):
136136
If we don't ask for stack_info, it won't be returned.
137137
"""
138138
logger = _FixedFindCallerLogger("test")
139-
testing, is_, fun, stack_info = logger.findCaller()
139+
testing, is_, fun, stack_info = logger.findCaller() # noqa: RUF059
140140

141141
assert None is stack_info
142142

@@ -230,7 +230,7 @@ def test_positional_args_proxied(self):
230230
Positional arguments supplied are proxied as kwarg.
231231
"""
232232
bl = BoundLogger(ReturnLogger(), [], {})
233-
args, kwargs = bl.debug("event", "foo", bar="baz")
233+
_args, kwargs = bl.debug("event", "foo", bar="baz")
234234

235235
assert "baz" == kwargs.get("bar")
236236
assert ("foo",) == kwargs.get("positional_args")

tests/test_twisted.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_extractFailsOnTwoFailures(self):
105105
"""
106106
with pytest.raises(
107107
ValueError,
108-
match="Both _stuff and event contain an Exception/Failure.",
108+
match="Both _stuff and event contain an Exception/Failure",
109109
):
110110
_extractStuffAndWhy(
111111
{
@@ -119,7 +119,7 @@ def test_failsOnConflictingEventAnd_why(self):
119119
Raise ValueError if both _why and event are in the event_dict.
120120
"""
121121
with pytest.raises(
122-
ValueError, match="Both `_why` and `event` supplied."
122+
ValueError, match="Both `_why` and `event` supplied"
123123
):
124124
_extractStuffAndWhy({"_why": "foo", "event": "bar"})
125125

@@ -222,7 +222,7 @@ def test_catchesConflictingEventAnd_why(self):
222222
la = EventAdapter(_render_repr)
223223

224224
with pytest.raises(
225-
ValueError, match="Both `_why` and `event` supplied."
225+
ValueError, match="Both `_why` and `event` supplied"
226226
):
227227
la(None, "err", {"event": "someEvent", "_why": "someReason"})
228228

0 commit comments

Comments
 (0)