mirror of
https://github.com/python/cpython.git
synced 2025-10-14 18:59:46 +00:00
bpo-38250: [Enum] only include .rst test if file available (GH-24342)
* [Enum] only include .rst test if file available In order to ensure the ReST documentation is up to date for Enum, use doctest to check it -- but only if the .rst files have not been stripped.
This commit is contained in:
parent
dea5bf9d15
commit
01faf4542a
1 changed files with 6 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
import enum
|
import enum
|
||||||
import doctest
|
import doctest
|
||||||
import inspect
|
import inspect
|
||||||
|
import os
|
||||||
import pydoc
|
import pydoc
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
@ -17,10 +18,11 @@ from datetime import timedelta
|
||||||
|
|
||||||
def load_tests(loader, tests, ignore):
|
def load_tests(loader, tests, ignore):
|
||||||
tests.addTests(doctest.DocTestSuite(enum))
|
tests.addTests(doctest.DocTestSuite(enum))
|
||||||
tests.addTests(doctest.DocFileSuite(
|
if os.path.exists('../../Doc/library/enum.rst'):
|
||||||
'../../Doc/library/enum.rst',
|
tests.addTests(doctest.DocFileSuite(
|
||||||
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
|
'../../Doc/library/enum.rst',
|
||||||
))
|
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
|
||||||
|
))
|
||||||
return tests
|
return tests
|
||||||
|
|
||||||
# for pickle tests
|
# for pickle tests
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue