Ticket #13610: 13610_review.patch

File 13610_review.patch, 4.4 KB (added by jdemeyer, 7 years ago)
  • sage/doctest/forker.py

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1364821014 -7200
    # Node ID f462635d90209b5fdca3fd94eb5c85b4c807dbac
    # Parent  e6f73b33fd5dd059fe6909844065cd810c1369ee
    sage -t --debug reviewer patch
    
    diff --git a/sage/doctest/forker.py b/sage/doctest/forker.py
    a b  
    949949
    950950        - prints a report to ``out``
    951951
     952        - if in debugging mode, starts an IPython prompt at the point
     953          of the failure
     954
    952955        EXAMPLES::
    953956
    954957            sage: from sage.doctest.parsing import SageOutputChecker
     
    10151018            Got:
    10161019                BAD ANSWER
    10171020
    1018         TESTS:
    1019 
    10201021        If debugging is turned on this function starts an IPython
    10211022        prompt when a test returns an incorrect answer::
    10221023
     
    10261027            sage: _ = sage0.eval("import doctest, sys, os, multiprocessing, subprocess")
    10271028            sage: _ = sage0.eval("from sage.doctest.parsing import SageOutputChecker")
    10281029            sage: _ = sage0.eval("import sage.doctest.forker as sdf")
     1030            sage: _ = sage0.eval("sdf.init_sage()")
    10291031            sage: _ = sage0.eval("from sage.doctest.control import DocTestDefaults")
    10301032            sage: _ = sage0.eval("DD = DocTestDefaults(debug=True)")
    10311033            sage: _ = sage0.eval("ex1 = doctest.Example('a = 17', '')")
     
    10421044                1
    10431045            Got:
    10441046                34
    1045             ********************************************************************************
     1047            **********************************************************************
    10461048            Previously executed commands:
    10471049            ...
    10481050            sage: sage0.eval("a")
     
    10661068                        signal.signal(signal.SIGTTIN, signal.SIG_IGN)
    10671069                        signal.signal(signal.SIGTTOU, signal.SIG_IGN)
    10681070                        os.tcsetpgrp(0, os.getpgrp())
    1069                     print("*" * 80)
     1071                    print("*" * 70)
    10701072                    print("Previously executed commands:")
    10711073                    for ex in test.examples:
    10721074                        if ex is example:
  • sage/doctest/test.py

    diff --git a/sage/doctest/test.py b/sage/doctest/test.py
    a b  
    209209    ...
    210210    16
    211211
     212Test the ``--debug`` option::
     213
     214    sage: subprocess.call(["sage", "-t", "--debug", "simple_failure.rst"], stdin=open(os.devnull), **kwds)  # long time
     215    Running doctests...
     216    Doctesting 1 file.
     217    sage -t simple_failure.rst
     218    **********************************************************************
     219    File "simple_failure.rst", line 7, in sage.doctest.tests.simple_failure
     220    Failed example:
     221        a * b
     222    Expected:
     223        20
     224    Got:
     225        15
     226    **********************************************************************
     227    Previously executed commands:
     228        s...: a = 3
     229        s...: b = 5
     230        s...: a + b
     231        8
     232    debug:
     233    <BLANKLINE>
     234    Returning to doctests...
     235    **********************************************************************
     236    1 item had failures:
     237       1 of   5 in sage.doctest.tests.simple_failure
     238        [4 tests, 1 failure, ...]
     239    ----------------------------------------------------------------------
     240    sage -t simple_failure.rst  # 1 doctest failed
     241    ----------------------------------------------------------------------
     242    ...
     243    1
     244
    212245Test running under gdb, without and with a timeout::
    213246
    214247    sage: subprocess.call(["sage", "-t", "--gdb", "1second.rst"], stdin=open(os.devnull), **kwds)  # long time, optional: gdb
  • new file sage/doctest/tests/simple_failure.rst

    diff --git a/sage/doctest/tests/simple_failure.rst b/sage/doctest/tests/simple_failure.rst
    new file mode 100644
    - +  
     1Test a simple doctest failure::
     2
     3    sage: a = 3
     4    sage: b = 5
     5    sage: a + b
     6    8
     7    sage: a * b
     8    20
  • sage/tests/cmdline.py

    diff --git a/sage/tests/cmdline.py b/sage/tests/cmdline.py
    a b  
    368368        Got:
    369369            4
    370370        **********************************************************************
     371        Previously executed commands:
     372            s...: assert True == False
     373        debug:
     374        <BLANKLINE>
     375        Returning to doctests...
     376        **********************************************************************
    371377        1 item had failures:
    372378           2 of   3 in ...
    373379            [2 tests, 2 failures, ...]