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):
195195 print (line , file = file )
196196
197197 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 ()
203200 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 )
207202 for line in indented .splitlines ():
208203 print (line , file = file )
209204
You can’t perform that action at this time.
0 commit comments