Skip to content

Commit 3693fb8

Browse files
committed
Ugly quickfix for broken tracebacks
1 parent 2e5427b commit 3693fb8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/pytest_markdown_docs/plugin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ def repr_failure(
115115
True # start capturing frames the first time we enter user code
116116
)
117117
line = (
118-
rawlines[frame_summary.lineno - 1] if frame_summary.lineno else ""
118+
rawlines[frame_summary.lineno - 1]
119+
if 1 <= frame_summary.lineno <= len(rawlines)
120+
else ""
119121
)
120122
else:
121123
lineno = frame_summary.lineno or 0

0 commit comments

Comments
 (0)