Skip to content

Commit 01faf45

Browse files
authored
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.
1 parent dea5bf9 commit 01faf45

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Lib/test/test_enum.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import enum
22
import doctest
33
import inspect
4+
import os
45
import pydoc
56
import sys
67
import unittest
@@ -17,10 +18,11 @@
1718

1819
def load_tests(loader, tests, ignore):
1920
tests.addTests(doctest.DocTestSuite(enum))
20-
tests.addTests(doctest.DocFileSuite(
21-
'../../Doc/library/enum.rst',
22-
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
23-
))
21+
if os.path.exists('../../Doc/library/enum.rst'):
22+
tests.addTests(doctest.DocFileSuite(
23+
'../../Doc/library/enum.rst',
24+
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
25+
))
2426
return tests
2527

2628
# for pickle tests

0 commit comments

Comments
 (0)