aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2021-01-26 12:52:52 -0800
committerGitHub <noreply@github.com>2021-01-26 12:52:52 -0800
commit01faf4542a8652adfbd3b3f897ba718e8ce43f5e (patch)
tree3221c9a57b80e3a32c345963ba4b6a7f281a817a
parentbpo-33387: update documentation for exception handling opcode changes (GH-24334) (diff)
downloadcpython-01faf4542a8652adfbd3b3f897ba718e8ce43f5e.tar.gz
cpython-01faf4542a8652adfbd3b3f897ba718e8ce43f5e.tar.bz2
cpython-01faf4542a8652adfbd3b3f897ba718e8ce43f5e.zip
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.
-rw-r--r--Lib/test/test_enum.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py
index daca2e3c83f..96de878faf7 100644
--- a/Lib/test/test_enum.py
+++ b/Lib/test/test_enum.py
@@ -1,6 +1,7 @@
import enum
import doctest
import inspect
+import os
import pydoc
import sys
import unittest
@@ -17,10 +18,11 @@ from datetime import timedelta
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