@@ -138,20 +138,21 @@ def pytest_addoption(parser):
138
138
help = "Annotate failures in GitHub Actions." ,
139
139
)
140
140
141
+
141
142
def pytest_configure (config ):
142
143
if not config .option .exclude_warning_annotations :
143
144
config .pluginmanager .register (_AnnotateWarnings (), "annotate_warnings" )
144
145
145
146
146
147
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 ,
155
156
):
156
157
"""Build a command to annotate a workflow."""
157
158
result = f"::{ command_name } "
@@ -165,15 +166,13 @@ def _build_workflow_command(
165
166
("title" , title ),
166
167
]
167
168
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 )
171
170
172
171
if message is not None :
173
172
result = result + "::" + _escape (message )
174
173
175
174
return result
176
175
177
176
178
- def _escape (s ) :
177
+ def _escape (s : str ) -> str :
179
178
return s .replace ("%" , "%25" ).replace ("\r " , "%0D" ).replace ("\n " , "%0A" )
0 commit comments