tests/test-doctest.py
changeset 52135 cf8d029a480b
parent 52134 479899e53816
equal deleted inserted replaced
52134:479899e53816 52135:cf8d029a480b
    41     # minimal copy of doctest.testmod()
    41     # minimal copy of doctest.testmod()
    42     finder = doctest.DocTestFinder()
    42     finder = doctest.DocTestFinder()
    43     checker = py3docchecker()
    43     checker = py3docchecker()
    44     runner = doctest.DocTestRunner(checker=checker, optionflags=optionflags)
    44     runner = doctest.DocTestRunner(checker=checker, optionflags=optionflags)
    45     for test in finder.find(mod, name):
    45     for test in finder.find(mod, name):
    46         runner.run(test)
    46         # Windows doesn't have time.tzset(), so skip methods that invoke it in
       
    47         # a doctest, without hardcoding the function name.  There is a feature
       
    48         # request for adding syntax to the test itself to conditionally skip
       
    49         # that would make this unnecessary:
       
    50         #
       
    51         # https://github.com/python/cpython/issues/117364
       
    52         for example in test.examples:
       
    53             if os.name == 'nt' and 'time.tzset()' in example.source:
       
    54                 break
       
    55         else:
       
    56             runner.run(test)
    47     runner.summarize()
    57     runner.summarize()
    48 
    58 
    49 
    59 
    50 DONT_RUN = []
    60 DONT_RUN = []
    51 
    61