Skip to content

Commit c2ca08a

Browse files
committed
Test for content before indexing.
When there are two directives in series, the first one will not have any content. As a result, self.content[0] will raise an error.
1 parent 534ea82 commit c2ca08a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pytest_doctestplus/sphinx/doctestplus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DoctestSkipDirective(Directive):
2626
def run(self):
2727
# Check if there is any valid argument, and skip it. Currently only
2828
# 'win32' is supported.
29-
if re.match('win32', self.content[0]):
29+
if len(self.content) > 0 and re.match("win32", self.content[0]):
3030
self.content = self.content[2:]
3131
code = '\n'.join(self.content)
3232
return [literal_block(code, code)]

0 commit comments

Comments
 (0)