Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.12] gh-108303: Move all doctest related files and tests to Lib/test/test_doctest/ (GH-112109) #114254

Merged
merged 1 commit into from Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/doctest.rst
Expand Up @@ -134,7 +134,7 @@ That's all you need to know to start making productive use of :mod:`doctest`!
Jump in. The following sections provide full details. Note that there are many
examples of doctests in the standard Python test suite and libraries.
Especially useful examples can be found in the standard test file
:file:`Lib/test/test_doctest.py`.
:file:`Lib/test/test_doctest/test_doctest.py`.


.. _doctest-simple-testmod:
Expand Down
1 change: 1 addition & 0 deletions Lib/test/libregrtest/findtests.py
Expand Up @@ -19,6 +19,7 @@
SPLITTESTDIRS: set[TestName] = {
"test_asyncio",
"test_concurrent_futures",
"test_doctests",
"test_future_stmt",
"test_gdb",
"test_inspect",
Expand Down
20 changes: 20 additions & 0 deletions Lib/test/support/pty_helper.py
Expand Up @@ -58,3 +58,23 @@ def terminate(proc):
input = b"" # Stop writing
if not input:
sel.modify(master, selectors.EVENT_READ)


######################################################################
## Fake stdin (for testing interactive debugging)
######################################################################

class FakeInput:
"""
A fake input stream for pdb's interactive debugger. Whenever a
line is read, print it (to simulate the user typing it), and then
return it. The set of lines to return is specified in the
constructor; they should not have trailing newlines.
"""
def __init__(self, lines):
self.lines = lines

def readline(self):
line = self.lines.pop(0)
print(line)
return line + '\n'
5 changes: 5 additions & 0 deletions Lib/test/test_doctest/__init__.py
@@ -0,0 +1,5 @@
import os
from test.support import load_package_tests

def load_tests(*args):
return load_package_tests(os.path.dirname(__file__), *args)
File renamed without changes.
File renamed without changes.
Expand Up @@ -32,8 +32,8 @@ def bar():
def test_silly_setup():
"""

>>> import test.test_doctest
>>> test.test_doctest.sillySetup
>>> import test.test_doctest.test_doctest
>>> test.test_doctest.test_doctest.sillySetup
True
"""

Expand Down