FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-116622: Enable `test_doctest` on platforms that don't support subprocesses by mhsmith · Pull Request #116758 · python/cpython · GitHub

/ cpython Public
11 changes: 8 additions & 3 deletions Lib/test/test_doctest/test_doctest.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
import contextlib


if not support.has_subprocess_support:
raise unittest.SkipTest("test_CLI requires subprocess support.")
def doctest_skip_if(condition):
def decorator(func):
if condition and support.HAVE_DOCSTRINGS:
func.__doc__ = ">>> pass # doctest: +SKIP"
return func
return decorator


# NOTE: There are some additional tests relating to interaction with
Expand Down Expand Up @@ -466,7 +470,7 @@ def basics(): r"""
>>> tests = finder.find(sample_func)

>>> print(tests) # doctest: +ELLIPSIS
[<DocTest sample_func from test_doctest.py:33 (1 example)>]
[<DocTest sample_func from test_doctest.py:37 (1 example)>]

The exact name depends on how test_doctest was invoked, so allow for
leading path components.
Expand Down Expand Up @@ -2944,6 +2948,7 @@ def test_unicode(): """
TestResults(failed=1, attempted=1)
"""

@doctest_skip_if(not support.has_subprocess_support)
def test_CLI(): r"""
The doctest module can be used to run doctests against an arbitrary file.
These tests test this CLI functionality.
Expand Down

Back | FazBrowse Home | New Git URL