@@ -522,8 +522,7 @@ def __init__(self, *args, **kwds):
522
522
- ``optionflags`` -- Controls the comparison with the expected
523
523
output. See :mod:`testmod` for more information.
524
524
525
- - ``baseline`` -- ``None`` or a dictionary, the ``baseline_stats``
526
- value
525
+ - ``baseline`` -- dictionary, the ``baseline_stats`` value
527
526
528
527
EXAMPLES::
529
528
@@ -538,9 +537,7 @@ def __init__(self, *args, **kwds):
538
537
O = kwds .pop ('outtmpfile' , None )
539
538
self .msgfile = kwds .pop ('msgfile' , None )
540
539
self .options = kwds .pop ('sage_options' )
541
- self .baseline = kwds .pop ('baseline' , None )
542
- if self .baseline is None :
543
- self .baseline = {}
540
+ self .baseline = kwds .pop ('baseline' , {})
544
541
doctest .DocTestRunner .__init__ (self , * args , ** kwds )
545
542
self ._fakeout = SageSpoofInOut (O )
546
543
if self .msgfile is None :
@@ -1727,20 +1724,16 @@ def serial_dispatch(self):
1727
1724
"""
1728
1725
for source in self .controller .sources :
1729
1726
heading = self .controller .reporter .report_head (source )
1730
- basename = source .basename
1731
- if self .controller .baseline_stats :
1732
- the_baseline_stats = self .controller .baseline_stats .get (basename , {})
1733
- else :
1734
- the_baseline_stats = {}
1735
- if the_baseline_stats .get ('failed' , False ):
1727
+ baseline = self .controller .source_baseline (source )
1728
+ if baseline .get ('failed' , False ):
1736
1729
heading += " # [failed in baseline]"
1737
1730
if not self .controller .options .only_errors :
1738
1731
self .controller .log (heading )
1739
1732
1740
1733
with tempfile .TemporaryFile () as outtmpfile :
1741
1734
result = DocTestTask (source )(self .controller .options ,
1742
1735
outtmpfile , self .controller .logger ,
1743
- baseline = the_baseline_stats )
1736
+ baseline = baseline )
1744
1737
outtmpfile .seek (0 )
1745
1738
output = bytes_to_str (outtmpfile .read ())
1746
1739
@@ -1999,16 +1992,12 @@ def sel_exit():
1999
1992
# Start a new worker.
2000
1993
import copy
2001
1994
worker_options = copy .copy (opt )
2002
- basename = source .basename
2003
- if self .controller .baseline_stats :
2004
- the_baseline_stats = self .controller .baseline_stats .get (basename , {})
2005
- else :
2006
- the_baseline_stats = {}
1995
+ baseline = self .controller .source_baseline (source )
2007
1996
if target_endtime is not None :
2008
1997
worker_options .target_walltime = (target_endtime - now ) / (max (1 , pending_tests / opt .nthreads ))
2009
- w = DocTestWorker (source , options = worker_options , baseline = the_baseline_stats , funclist = [sel_exit ])
1998
+ w = DocTestWorker (source , options = worker_options , funclist = [sel_exit ], baseline = baseline )
2010
1999
heading = self .controller .reporter .report_head (w .source )
2011
- if the_baseline_stats .get ('failed' , False ):
2000
+ if baseline .get ('failed' , False ):
2012
2001
heading += " # [failed in baseline]"
2013
2002
if not self .controller .options .only_errors :
2014
2003
w .messages = heading + "\n "
@@ -2149,6 +2138,8 @@ class should be accessed by the child process.
2149
2138
- ``funclist`` -- a list of callables to be called at the start of
2150
2139
the child process.
2151
2140
2141
+ - ``baseline`` -- dictionary, the ``baseline_stats`` value
2142
+
2152
2143
EXAMPLES::
2153
2144
2154
2145
sage: from sage.doctest.forker import DocTestWorker, DocTestTask
@@ -2264,7 +2255,8 @@ def run(self):
2264
2255
os .close (self .rmessages )
2265
2256
msgpipe = os .fdopen (self .wmessages , "w" )
2266
2257
try :
2267
- task (self .options , self .outtmpfile , msgpipe , self .result_queue , baseline = self .baseline )
2258
+ task (self .options , self .outtmpfile , msgpipe , self .result_queue ,
2259
+ baseline = self .baseline )
2268
2260
finally :
2269
2261
msgpipe .close ()
2270
2262
self .outtmpfile .close ()
@@ -2548,8 +2540,7 @@ def __call__(self, options, outtmpfile=None, msgfile=None, result_queue=None, *,
2548
2540
- ``result_queue`` -- an instance of :class:`multiprocessing.Queue`
2549
2541
to store the doctest result. For testing, this can also be None.
2550
2542
2551
- - ``baseline`` -- ``None`` or a dictionary, the ``baseline_stats``
2552
- value.
2543
+ - ``baseline`` -- a dictionary, the ``baseline_stats`` value.
2553
2544
2554
2545
OUTPUT:
2555
2546
0 commit comments