GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update doctest,test_generators from v3.14.2 and fix generator bugs by youknowone · Pull Request #7067 · RustPython/RustPython

Update doctest,test_generators from v3.14.2 and fix generator bugs #7067

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.

Sign up for GitHub

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

Merged
youknowone merged 4 commits into RustPython:main from youknowone:doctest
Feb 11, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Update doctest,test_generators from v3.14.2 and fix generator bugs #7067

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
4 commits
Select commit Hold shift + click to select a range
5c341ef
Implement generator/coroutine lifecycle, tracing, and error handling
youknowone Feb 11, 2026
e616f25
Update doctest from v3.14.2
Feb 11, 2026
cafde31
Update test_generators from v3.14.2
Feb 11, 2026
ad6e965
apply tests
youknowone Feb 11, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

34 changes: 18 additions & 16 deletions 34 Lib/doctest.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def _test():
from _colorize import ANSIColors, can_colorize


__unittest = True

class TestResults(namedtuple('TestResults', 'failed attempted')):
def __new__(cls, failed, attempted, *, skipped=0):
results = super().__new__(cls, failed, attempted)
Expand Down Expand Up @@ -390,11 +392,11 @@ def __init__(self, out):
# still use input() to get user input
self.use_rawinput = 1

def set_trace(self, frame=None):
def set_trace(self, frame=None, *, commands=None):
self.__debugger_used = True
if frame is None:
frame = sys._getframe().f_back
pdb.Pdb.set_trace(self, frame)
pdb.Pdb.set_trace(self, frame, commands=commands)

def set_continue(self):
# Calling set_continue unconditionally would break unit test
Expand Down Expand Up @@ -1230,7 +1232,7 @@ class DocTestRunner:
`OutputChecker` to the constructor.

The test runner's display output can be controlled in two ways.
First, an output function (`out) can be passed to
First, an output function (`out`) can be passed to
`TestRunner.run`; this function will be called with strings that
should be displayed. It defaults to `sys.stdout.write`. If
capturing the output is not sufficient, then the display output
Expand Down Expand Up @@ -1398,11 +1400,11 @@ def __run(self, test, compileflags, out):
exec(compile(example.source, filename, "single",
compileflags, True), test.globs)
self.debugger.set_continue() # ==== Example Finished ====
exception = None
exc_info = None
except KeyboardInterrupt:
raise
except:
exception = sys.exc_info()
except BaseException as exc:
exc_info = type(exc), exc, exc.__traceback__.tb_next
self.debugger.set_continue() # ==== Example Finished ====

got = self._fakeout.getvalue() # the actual output
Expand All @@ -1411,21 +1413,21 @@ def __run(self, test, compileflags, out):

# If the example executed without raising any exceptions,
# verify its output.
if exception is None:
if exc_info is None:
if check(example.want, got, self.optionflags):
outcome = SUCCESS

# The example raised an exception: check if it was expected.
else:
formatted_ex = traceback.format_exception_only(*exception[:2])
if issubclass(exception[0], SyntaxError):
formatted_ex = traceback.format_exception_only(*exc_info[:2])
if issubclass(exc_info[0], SyntaxError):
# SyntaxError / IndentationError is special:
# we don't care about the carets / suggestions / etc
# We only care about the error message and notes.
# They start with `SyntaxError:` (or any other class name)
exception_line_prefixes = (
f"{exception[0].__qualname__}:",
f"{exception[0].__module__}.{exception[0].__qualname__}:",
f"{exc_info[0].__qualname__}:",
f"{exc_info[0].__module__}.{exc_info[0].__qualname__}:",
)
exc_msg_index = next(
index
Expand All @@ -1436,7 +1438,7 @@ def __run(self, test, compileflags, out):

exc_msg = "".join(formatted_ex)
if not quiet:
got += _exception_traceback(exception)
got += _exception_traceback(exc_info)

# If `example.exc_msg` is None, then we weren't expecting
# an exception.
Expand Down Expand Up @@ -1465,7 +1467,7 @@ def __run(self, test, compileflags, out):
elif outcome is BOOM:
if not quiet:
self.report_unexpected_exception(out, test, example,
exception)
exc_info)
failures += 1
else:
assert False, ("unknown outcome", outcome)
Expand Down Expand Up @@ -2327,7 +2329,7 @@ def runTest(self):
sys.stdout = old

if results.failed:
raise self.failureException(self.format_failure(new.getvalue()))
raise self.failureException(self.format_failure(new.getvalue().rstrip('\n')))

def format_failure(self, err):
test = self._dt_test
Expand Down Expand Up @@ -2737,7 +2739,7 @@ def testsource(module, name):
return testsrc

def debug_src(src, pm=False, globs=None):
"""Debug a single doctest docstring, in argument `src`'"""
"""Debug a single doctest docstring, in argument `src`"""
testsrc = script_from_examples(src)
debug_script(testsrc, pm, globs)

Expand Down Expand Up @@ -2873,7 +2875,7 @@ def get(self):
def _test():
import argparse

parser = argparse.ArgumentParser(description="doctest runner")
parser = argparse.ArgumentParser(description="doctest runner", color=True)
parser.add_argument('-v', '--verbose', action='store_true', default=False,
help='print very verbose output for all tests')
parser.add_argument('-o', '--option', action='append',
Expand Down
9 changes: 9 additions & 0 deletions 9 Lib/pdb.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None,
self.commands_bnum = None # The breakpoint number for which we are
# defining a list

def set_trace(self, frame=None, *, commands=None):
if frame is None:
frame = sys._getframe().f_back

if commands is not None:
self.rcLines.extend(commands)

super().set_trace(frame)

def sigint_handler(self, signum, frame):
if self.allow_kbdint:
raise KeyboardInterrupt
Expand Down
2 changes: 1 addition & 1 deletion 2 Lib/test/test_concurrent_futures/test_wait.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class ProcessPoolForkWaitTest(ProcessPoolForkWaitTest): # TODO: RUSTPYTHON
def test_first_completed(self): super().test_first_completed() # TODO: RUSTPYTHON
@unittest.skipIf(sys.platform == 'linux', "TODO: RUSTPYTHON Fatal Python error: Segmentation fault")
def test_first_completed_some_already_completed(self): super().test_first_completed_some_already_completed() # TODO: RUSTPYTHON
@unittest.skipIf(sys.platform == 'linux', "TODO: RUSTPYTHON flaky")
@unittest.skipIf(sys.platform != 'win32', "TODO: RUSTPYTHON flaky")
def test_first_exception(self): super().test_first_exception() # TODO: RUSTPYTHON
@unittest.skipIf(sys.platform == 'linux', "TODO: RUSTPYTHON flaky")
def test_first_exception_one_already_failed(self): super().test_first_exception_one_already_failed() # TODO: RUSTPYTHON
Expand Down
12 changes: 8 additions & 4 deletions 12 Lib/test/test_dbm.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test script for the dbm.open function based on testdumbdbm.py"""

import sys
import unittest
import dbm
import os
Expand Down Expand Up @@ -252,10 +253,13 @@ def setUp(self):
assert mod.__name__.startswith('dbm.')
suffix = mod.__name__[4:]
testname = f'TestCase_{suffix}'
globals()[testname] = type(testname,
(AnyDBMTestCase, unittest.TestCase),
{'module': mod})

cls = type(testname,
(AnyDBMTestCase, unittest.TestCase),
{'module': mod})
# TODO: RUSTPYTHON; sqlite3 file locking prevents cleanup on Windows
if suffix == 'sqlite3' and sys.platform == 'win32':
cls = unittest.skip("TODO: RUSTPYTHON; sqlite3 file locking on Windows")(cls)
globals()[testname] = cls

if __name__ == "__main__":
unittest.main()
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.