Skip to content

Commit

Permalink
pythongh-108303: Move all doctest related files and tests to `Lib/tes…
Browse files Browse the repository at this point in the history
…t/test_doctest/` (python#112109)

Co-authored-by: Brett Cannon <[email protected]>
  • Loading branch information
2 people authored and Glyphack committed Jan 27, 2024
1 parent ebb1bad commit bce5c23
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 117 deletions.
2 changes: 1 addition & 1 deletion Doc/library/doctest.rst
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
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
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit bce5c23

Please sign in to comment.