Skip to content

Commit 238a9a0

Browse files
author
Release Manager
committed
gh-40346: remove deprecated method in doctest/control That was deprecated in #32981. ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. URL: #40346 Reported by: Frédéric Chapoton Reviewer(s): David Coudert
2 parents 456cfc9 + 5b0c569 commit 238a9a0

File tree

1 file changed

+4
-40
lines changed

1 file changed

+4
-40
lines changed

src/sage/doctest/control.py

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def skipfile(filename, tested_optional_tags=False, *,
292292
if filename.endswith('.rst.txt'):
293293
ext = '.rst.txt'
294294
else:
295-
_ , ext = os.path.splitext(filename)
295+
_, ext = os.path.splitext(filename)
296296
# .rst.txt appear in the installed documentation in subdirectories named "_sources"
297297
if ext not in ('.py', '.pyx', '.pxd', '.pxi', '.sage', '.spyx', '.rst', '.tex', '.rst.txt'):
298298
if log:
@@ -628,44 +628,7 @@ def _init_warn_long(self):
628628
if self.options.long:
629629
self.options.warn_long = 30.0
630630

631-
def second_on_modern_computer(self):
632-
"""
633-
Return the wall time equivalent of a second on a modern computer.
634-
635-
OUTPUT:
636-
637-
Float. The wall time on your computer that would be equivalent
638-
to one second on a modern computer. Unless you have kick-ass
639-
hardware this should always be >= 1.0. This raises a
640-
:exc:`RuntimeError` if there are no stored timings to use as
641-
benchmark.
642-
643-
EXAMPLES::
644-
645-
sage: from sage.doctest.control import DocTestDefaults, DocTestController
646-
sage: DC = DocTestController(DocTestDefaults(), [])
647-
sage: DC.second_on_modern_computer() # not tested
648-
"""
649-
from sage.misc.superseded import deprecation
650-
deprecation(32981, "this method is no longer used by the sage library and will eventually be removed")
651-
652-
if len(self.stats) == 0:
653-
raise RuntimeError('no stored timings available')
654-
success = []
655-
failed = []
656-
for mod in self.stats.values():
657-
if mod.get('failed', False):
658-
failed.append(mod['walltime'])
659-
else:
660-
success.append(mod['walltime'])
661-
if len(success) < 2500:
662-
raise RuntimeError('too few successful tests, not using stored timings')
663-
if len(failed) > 20:
664-
raise RuntimeError('too many failed tests, not using stored timings')
665-
expected = 12800.0 # Core i7 Quad-Core 2014
666-
return sum(success) / expected
667-
668-
def _repr_(self):
631+
def _repr_(self) -> str:
669632
"""
670633
String representation.
671634
@@ -1042,7 +1005,8 @@ def expand():
10421005
if_installed=self.options.if_installed):
10431006
yield os.path.join(root, file)
10441007
elif not skipfile(path, bool(self.options.optional),
1045-
if_installed=self.options.if_installed, log=self.log): # log when directly specified filenames are skipped
1008+
if_installed=self.options.if_installed,
1009+
log=self.log): # log when directly specified filenames are skipped
10461010
yield path
10471011
self.sources = [FileDocTestSource(path, self.options) for path in expand()]
10481012

0 commit comments

Comments
 (0)