Download Sage Developer`s Guide
Transcript
Sage Developer’s Guide, Release 6.9 [roed@sage sage-6.0]$ sage -tp 2 src/sage/doctest/ Running doctests with ID 2012-06-22-19-09-25-a3afdb8c. Sorting sources by runtime so that slower doctests are run first.... Doctesting 8 files using 2 threads. sage -t src/sage/doctest/control.py [114 tests, 4.6 s] sage -t src/sage/doctest/util.py [114 tests, 0.6 s] sage -t src/sage/doctest/parsing.py [187 tests, 0.5 s] sage -t src/sage/doctest/sources.py [128 tests, 0.1 s] sage -t src/sage/doctest/reporting.py [53 tests, 0.1 s] sage -t src/sage/doctest/all.py [0 tests, 0.0 s] sage -t src/sage/doctest/__init__.py [0 tests, 0.0 s] sage -t src/sage/doctest/forker.py [322 tests, 15.5 s] -----------------------------------------------------------------------All tests passed! -----------------------------------------------------------------------Total time for all tests: 17.0 seconds cpu time: 4.2 seconds cumulative wall time: 21.5 seconds Doctesting All of Sage To doctest the whole Sage library use the --all flag (-a for short). In addition to testing the code in Sage’s Python and Cython files, this command will run the tests defined in Sage’s documentation as well as testing the Sage notebook: [roed@sage sage-6.0]$ sage -t -a Running doctests with ID 2012-06-22-19-10-27-e26fce6d. Doctesting entire Sage library. Sorting sources by runtime so that slower doctests are run first.... Doctesting 2020 files. sage -t /Users/roed/sage/sage-5.3/src/sage/plot/plot.py [304 tests, 69.0 s] ... If you want to just run the notebook tests, use the --sagenb flag instead. Debugging Tools Sometimes doctests fail (that’s why we run them after all). There are various flags to help when something goes wrong. If a doctest produces a Python error, then normally tests continue after reporting that an error occurred. If you use the flag --debug (-d for short) then you will drop into an interactive Python debugger whenever a Python exception occurs. As an example, I modified sage.schemes.elliptic_curves.constructor to produce an error: [roed@sage sage-6.0]$ sage -t --debug src/sage/schemes/elliptic_curves/constructor.py Running doctests with ID 2012-06-23-12-09-04-b6352629. Doctesting 1 file. ********************************************************************** File "sage.schemes.elliptic_curves.constructor", line 4, in sage.schemes.elliptic_curves.constructor 70 Chapter 3. Writing Code for Sage