File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,15 @@ def _to_doctest_format(output: str) -> str:
123
123
lines = output .splitlines ()
124
124
blankline_sentinel = "<BLANKLINE>"
125
125
transformed_lines = [line if line else blankline_sentinel for line in lines ]
126
- return "\n " .join (transformed_lines )
126
+ # In some pathological cases, this can crash an editor.
127
+ shortened_lines = [
128
+ line if len (line ) < 1000 else f"{ line [:50 ]} ...{ line [- 50 :]} "
129
+ for line in transformed_lines
130
+ ]
131
+ # Again, only for the pathological cases.
132
+ if len (shortened_lines ) > 1000 :
133
+ shortened_lines = shortened_lines [:50 ] + ["..." ] + shortened_lines [- 50 :]
134
+ return "\n " .join (shortened_lines )
127
135
128
136
129
137
def pytest_sessionfinish (session , exitstatus ):
You can’t perform that action at this time.
0 commit comments