Skip to content

Commit

Permalink
[3.11] pythongh-108303: Move all doctest related files and tests to `…
Browse files Browse the repository at this point in the history
…Lib/test/test_doctest/` (pythonGH-112109) (python#114313)

pythongh-108303: Move all doctest related files and tests to `Lib/test/test_doctest/` (pythonGH-112109)
  • Loading branch information
sobolevn authored Jan 19, 2024
1 parent ac4c6ef commit a4ad7a0
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 118 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 a4ad7a0

Please sign in to comment.