-
-
Notifications
You must be signed in to change notification settings - Fork 631
Fix doctesting with Python 3.13 #39147
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -553,6 +553,8 @@ | |||||
self.total_walltime_skips = 0 | ||||||
self.total_performed_tests = 0 | ||||||
self.total_walltime = 0 | ||||||
if sys.version_info < (3,13): | ||||||
self._stats = self._name2ft | ||||||
|
||||||
def _run(self, test, compileflags, out): | ||||||
""" | ||||||
|
@@ -830,7 +832,10 @@ | |||||
self.optionflags = original_optionflags | ||||||
|
||||||
# Record and return the number of failures and tries. | ||||||
self._DocTestRunner__record_outcome(test, failures, tries) | ||||||
if sys.version_info < (3,13): | ||||||
self._DocTestRunner__record_outcome(test, failures, tries) | ||||||
else: | ||||||
self._DocTestRunner__record_outcome(test, failures, tries, walltime_skips) | ||||||
self.total_walltime_skips += walltime_skips | ||||||
self.total_performed_tests += tries | ||||||
return TestResults(failures, tries) | ||||||
|
@@ -931,7 +936,7 @@ | |||||
sage: from sage.doctest.control import DocTestDefaults; DD = DocTestDefaults() | ||||||
sage: import doctest, sys, os | ||||||
sage: DTR = SageDocTestRunner(SageOutputChecker(), verbose=False, sage_options=DD, optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS) | ||||||
sage: DTR._name2ft['sage.doctest.forker'] = (1,120) | ||||||
sage: DTR._stats['sage.doctest.forker'] = (1,120) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It seems the difference between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's the point. I think the doctest can be left as is because it's just mocking the result here… otherwise you'll need to do a version check. I suggest adding an explanation why you're doing that here, so people coming across this in the future won't need to |
||||||
sage: results = DTR.summarize() | ||||||
********************************************************************** | ||||||
1 item had failures: | ||||||
|
@@ -946,8 +951,8 @@ | |||||
passed = [] | ||||||
failed = [] | ||||||
totalt = totalf = 0 | ||||||
for x in self._name2ft.items(): | ||||||
name, (f, t) = x | ||||||
for x in self._stats.items(): | ||||||
name, (f, t, *_) = x | ||||||
assert f <= t | ||||||
totalt += t | ||||||
totalf += f | ||||||
|
@@ -972,10 +977,10 @@ | |||||
print(self.DIVIDER, file=m) | ||||||
print(count_noun(len(failed), "item"), "had failures:", file=m) | ||||||
failed.sort() | ||||||
for thing, (f, t) in failed: | ||||||
for thing, (f, t, *_) in failed: | ||||||
print(" %3d of %3d in %s" % (f, t, thing), file=m) | ||||||
if verbose: | ||||||
print(count_noun(totalt, "test") + " in " + count_noun(len(self._name2ft), "item") + ".", file=m) | ||||||
print(count_noun(totalt, "test") + " in " + count_noun(len(self._stats), "item") + ".", file=m) | ||||||
print("%s passed and %s failed." % (totalt - totalf, totalf), file=m) | ||||||
if totalf: | ||||||
print("***Test Failed***", file=m) | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.