File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -195,15 +195,10 @@ def pytest_sessionfinish(session, exitstatus):
195
195
print (line , file = file )
196
196
197
197
for current , next in zip_longest (failures , failures [1 :]):
198
- # Note that `current.example.indent` no longer works in python 3.13,
199
- # since docstrings are now dedented. So we calculate it from the source.
200
- existing_indent = len (
201
- re .match (r" *" , original [next_start_line ]).group ()
202
- )
198
+ # Get the existing indentation from the source line
199
+ existing_indent = re .match (r"\s*" , original [next_start_line ]).group ()
203
200
snapshot_result = _to_doctest_format (current .got )
204
- indented = textwrap .indent (
205
- snapshot_result , prefix = " " * existing_indent
206
- )
201
+ indented = textwrap .indent (snapshot_result , prefix = existing_indent )
207
202
for line in indented .splitlines ():
208
203
print (line , file = file )
209
204
You can’t perform that action at this time.
0 commit comments