Skip to content

Commit 8177fef

Browse files
committed
Add an unprincipled hack for when all else fails
I don't even feel bad - I've spent months making Sphinx *able to report correctly in ideal circumstances*, so when it doesn't we just look at the most likely location.
1 parent 52943c3 commit 8177fef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scripts/fix_doctests.py

+5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ def indices(self):
6767
return slice(self.line, self.line + len(self.expected_lines))
6868

6969
def adjust(self):
70+
if self.line is None and self.file.endswith('.rst'):
71+
# Sphinx reports an unknown line number when the doctest is
72+
# included from a docstring, so docutils must have misreported the
73+
# file location. We thus force it to the most likley candidate:
74+
self.file = 'src/hypothesis/strategies.py'
7075
with open(self.file) as f:
7176
lines = f.read().split('\n')
7277
if self.line is not None:

0 commit comments

Comments
 (0)