Skip to content

Commit

Permalink
bpo-38250: [Enum] only include .rst test if file available (GH-24342)
Browse files Browse the repository at this point in the history
* [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.
  • Loading branch information
ethanfurman authored Jan 26, 2021
1 parent dea5bf9 commit 01faf45
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Lib/test/test_enum.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import enum
import doctest
import inspect
import os
import pydoc
import sys
import unittest
Expand All @@ -17,10 +18,11 @@

def load_tests(loader, tests, ignore):
tests.addTests(doctest.DocTestSuite(enum))
tests.addTests(doctest.DocFileSuite(
'../../Doc/library/enum.rst',
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
))
if os.path.exists('../../Doc/library/enum.rst'):
tests.addTests(doctest.DocFileSuite(
'../../Doc/library/enum.rst',
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
))
return tests

# for pickle tests
Expand Down

0 comments on commit 01faf45

Please sign in to comment.