Ticket #14203: trac_14203_doctest.patch

File trac_14203_doctest.patch, 6.0 KB (added by jhpalmieri, 7 years ago)

initial patch

  • sage/doctest/__init__.py

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1362089743 28800
    # Node ID 3fe559ffdf7d32bc8a0c406aeb59f8369feb2abd
    # Parent  80e293508a5892c71fe27d5cf0ecb91ab76c37d0
    Move the definition of DOCTEST_MODE to sage/doctest/__init__.py
    
    diff --git a/sage/doctest/__init__.py b/sage/doctest/__init__.py
    a b  
     1# This flag gets set to True by sage.doctest.forker.init_sage at the
     2# beginning of each doctest run.
     3DOCTEST_MODE = False
  • sage/doctest/control.py

    diff --git a/sage/doctest/control.py b/sage/doctest/control.py
    a b  
    892892    DC = DocTestController(options, F)
    893893
    894894    # Determine whether we're in doctest mode
    895     import sage.plot.plot
    896     save_dtmode = sage.plot.plot.DOCTEST_MODE
     895    save_dtmode = sage.doctest.DOCTEST_MODE
    897896
    898897    # We need the following if we're not in DOCTEST_MODE
    899898    # Tell IPython to avoid colors: it screws up the output checking.
     
    905904    try:
    906905        DC.run()
    907906    finally:
    908         sage.plot.plot.DOCTEST_MODE = save_dtmode
     907        sage.doctest.DOCTEST_MODE = save_dtmode
    909908        if not save_dtmode:
    910909            IP.run_line_magic('colors',old_color)
  • sage/doctest/forker.py

    diff --git a/sage/doctest/forker.py b/sage/doctest/forker.py
    a b  
    5252    EXAMPLES::
    5353
    5454        sage: from sage.doctest.forker import init_sage
    55         sage: sage.plot.plot.DOCTEST_MODE = False
     55        sage: sage.doctest.DOCTEST_MODE = False
    5656        sage: init_sage()
    57         sage: sage.plot.plot.DOCTEST_MODE
     57        sage: sage.doctest.DOCTEST_MODE
    5858        True
    5959
    6060    Check that pexpect interfaces are invalidated, but still work::
     
    7373    """
    7474    # Do this once before forking.
    7575    import sage.all_cmdline
    76     sage.plot.plot.DOCTEST_MODE=True
     76    sage.doctest.DOCTEST_MODE=True
    7777    sage.interfaces.quit.invalidate_all()
    7878    import sage.misc.displayhook
    7979    sys.displayhook = sage.misc.displayhook.DisplayHook(sys.displayhook)
  • sage/matrix/matrix_modn_sparse.pyx

    diff --git a/sage/matrix/matrix_modn_sparse.pyx b/sage/matrix/matrix_modn_sparse.pyx
    a b  
    644644
    645645        if filename is None:
    646646            filename = sage.misc.temporary_file.graphics_filename()
    647             if sage.plot.plot.DOCTEST_MODE:
     647            if sage.doctest.DOCTEST_MODE:
    648648                import os
    649649                filename = os.path.join(sage.misc.temporary_file.tmp_dir(), filename)
    650650
  • sage/misc/functional.py

    diff --git a/sage/misc/functional.py b/sage/misc/functional.py
    a b  
    16251625    _do_show(x)
    16261626
    16271627def _do_show(x):
    1628     if sage.plot.plot.DOCTEST_MODE:
     1628    if sage.doctest.DOCTEST_MODE:
    16291629        return sage.misc.latex.latex(x)
    16301630    from latex import view
    16311631    view(x, mode='display')
  • sage/misc/hg.py

    diff --git a/sage/misc/hg.py b/sage/misc/hg.py
    a b  
    336336
    337337            sage: hg_sage._warning() # random
    338338        """
    339         from sage.plot.plot import DOCTEST_MODE
     339        from sage.doctest import DOCTEST_MODE
    340340        if not os.path.exists(os.path.join(os.environ['HOME'], '.hgrc')) and not DOCTEST_MODE:
    341341            print "\nWARNING:"
    342342            print "Make sure to create a ~/.hgrc file:"
  • sage/misc/stopgap.pyx

    diff --git a/sage/misc/stopgap.pyx b/sage/misc/stopgap.pyx
    a b  
    1313import warnings
    1414from warnings import warn, resetwarnings
    1515
    16 from sage.plot.plot import DOCTEST_MODE
     16from sage.doctest import DOCTEST_MODE
    1717cdef bint ENABLED = not DOCTEST_MODE
    1818
    1919def set_state(bint mode):
  • sage/plot/animate.py

    diff --git a/sage/plot/animate.py b/sage/plot/animate.py
    a b  
    449449
    450450              See www.imagemagick.org and www.ffmpeg.org for more information.
    451451        """
    452         if plot.DOCTEST_MODE:
     452        if sage.doctest.DOCTEST_MODE:
    453453            filename = tmp_filename(ext='.gif')
    454454            self.gif(savefile=filename, delay=delay, iterations=iterations)
    455455            return
  • sage/plot/graphics.py

    diff --git a/sage/plot/graphics.py b/sage/plot/graphics.py
    a b  
    17851785        # This option should not be passed on to save().
    17861786        linkmode = kwds.pop('linkmode', False)
    17871787
    1788         if sage.plot.plot.DOCTEST_MODE:
     1788        if sage.doctest.DOCTEST_MODE:
    17891789            kwds.pop('filename', None)
    17901790            self.save(DOCTEST_MODE_FILE, **kwds)
    17911791        elif sage.plot.plot.EMBEDDED_MODE:
     
    30423042            sage: G.show(axes=False)
    30433043        """
    30443044        if (figsize is not None): self._set_figsize_(figsize)
    3045         if sage.plot.plot.DOCTEST_MODE:
     3045        if sage.doctest.DOCTEST_MODE:
    30463046            self.save(DOCTEST_MODE_FILE,
    30473047                      dpi=dpi, figsize=self._figsize, axes = axes, **args)
    30483048            return
  • sage/plot/plot.py

    diff --git a/sage/plot/plot.py b/sage/plot/plot.py
    a b  
    357357
    358358#DEFAULT_FIGSIZE=(6, 3.70820393249937)
    359359EMBEDDED_MODE = False
    360 DOCTEST_MODE = False
    361360import sage.misc.misc
    362361from sage.misc.misc import srange
    363362
  • sage/plot/plot3d/base.pyx

    diff --git a/sage/plot/plot3d/base.pyx b/sage/plot/plot3d/base.pyx
    a b  
    10761076        else:
    10771077            filename = tmp_filename()
    10781078
    1079         from sage.plot.plot import EMBEDDED_MODE, DOCTEST_MODE
     1079        from sage.plot.plot import EMBEDDED_MODE
     1080        from sage.doctest import DOCTEST_MODE
    10801081        ext = None
    10811082
    10821083        # Tachyon resolution options
  • sage/plot/plot3d/tachyon.py

    diff --git a/sage/plot/plot3d/tachyon.py b/sage/plot/plot3d/tachyon.py
    a b  
    312312            sage: q.show(verbose = False)
    313313        """
    314314        import sage.plot.plot
    315         if sage.plot.plot.DOCTEST_MODE:
     315        if sage.doctest.DOCTEST_MODE:
    316316            filename = graphics_filename()
    317317            self.save(os.path.join(SAGE_TMP, 'test.png'), verbose=verbose, extra_opts=extra_opts)
    318318            return