Skip to content

Commit 5b0c569

Browse files
committed
remove deprecated method in doctest/control
1 parent 665a3fa commit 5b0c569

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
@@ -293,7 +293,7 @@ def skipfile(filename, tested_optional_tags=False, *,
293293
if filename.endswith('.rst.txt'):
294294
ext = '.rst.txt'
295295
else:
296-
_ , ext = os.path.splitext(filename)
296+
_, ext = os.path.splitext(filename)
297297
# .rst.txt appear in the installed documentation in subdirectories named "_sources"
298298
if ext not in ('.py', '.pyx', '.pxd', '.pxi', '.sage', '.spyx', '.rst', '.tex', '.rst.txt'):
299299
if log:
@@ -629,44 +629,7 @@ def _init_warn_long(self):
629629
if self.options.long:
630630
self.options.warn_long = 30.0
631631

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

0 commit comments

Comments
 (0)