@@ -397,6 +397,9 @@ class DocTestParserPlus(doctest.DocTestParser):
397397
398398 - ``.. doctest-remote-data::``: Skip the next doctest chunk if
399399 --remote-data is not passed.
400+
401+ - ``.. doctest-remote-data-all::``: Skip all subsequent doctest
402+ chunks if --remote-data is not passed.
400403 """
401404
402405 def parse (self , s , name = None ):
@@ -429,15 +432,24 @@ def parse(self, s, name=None):
429432 required_all = []
430433 skip_next = False
431434 lines = entry .strip ().splitlines ()
435+
432436 requires_all_match = [re .match (
433437 fr'{ comment_char } \s+doctest-requires-all\s*::\s+(.*)' , x ) for x in lines ]
434438 if any (requires_all_match ):
435- required_all = [re .split (r'\s*[,\s]\s*' , match .group (1 )) for match in requires_all_match if match ][ 0 ]
436-
439+ required_all = [re .split (r'\s*[,\s]\s*' , match .group (1 ))
440+ for match in requires_all_match if match ][ 0 ]
437441 required_modules_all = DocTestFinderPlus .check_required_modules (required_all )
442+ if not required_modules_all :
443+ skip_all = True
444+ continue
445+
446+ if config .getoption ('remote_data' , 'none' ) != 'any' :
447+ if any (re .match (fr'{ comment_char } \s+doctest-remote-data-all\s*::' , x .strip ())
448+ for x in lines ):
449+ skip_all = True
450+ continue
438451
439- if any (re .match (
440- f'{ comment_char } doctest-skip-all' , x .strip ()) for x in lines ) or not required_modules_all :
452+ if any (re .match (f'{ comment_char } doctest-skip-all' , x .strip ()) for x in lines ):
441453 skip_all = True
442454 continue
443455
0 commit comments