Skip to content

Commit f27f233

Browse files
Add more type annotations
1 parent 6213c60 commit f27f233

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

plugin_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ def test_error():
4949
result = testdir.runpytest_subprocess()
5050

5151
result.stderr.re_match_lines(
52-
[r"::error file=test_annotation_pytest_error\.py,line=8::test_error.*",]
52+
[
53+
r"::error file=test_annotation_pytest_error\.py,line=8::test_error.*",
54+
]
5355
)
5456

5557

pytest_github_actions_annotate_failures/plugin.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,21 @@ def pytest_addoption(parser):
138138
help="Annotate failures in GitHub Actions.",
139139
)
140140

141+
141142
def pytest_configure(config):
142143
if not config.option.exclude_warning_annotations:
143144
config.pluginmanager.register(_AnnotateWarnings(), "annotate_warnings")
144145

145146

146147
def _build_workflow_command(
147-
command_name,
148-
file,
149-
line,
150-
end_line=None,
151-
column=None,
152-
end_column=None,
153-
title=None,
154-
message=None,
148+
command_name: str,
149+
file: str,
150+
line: int,
151+
end_line: int | None = None,
152+
column: int | None = None,
153+
end_column: int | None = None,
154+
title: str | None = None,
155+
message: str | None = None,
155156
):
156157
"""Build a command to annotate a workflow."""
157158
result = f"::{command_name} "
@@ -165,15 +166,13 @@ def _build_workflow_command(
165166
("title", title),
166167
]
167168

168-
result = result + ",".join(
169-
f"{k}={v}" for k, v in entries if v is not None
170-
)
169+
result = result + ",".join(f"{k}={v}" for k, v in entries if v is not None)
171170

172171
if message is not None:
173172
result = result + "::" + _escape(message)
174173

175174
return result
176175

177176

178-
def _escape(s):
177+
def _escape(s: str) -> str:
179178
return s.replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A")

0 commit comments

Comments
 (0)