Download Sage Developer`s Guide

Transcript
Sage Developer’s Guide, Release 6.9
Troubleshooting
To doctest modules of a Sage installation, from a terminal window we first cd to the top level directory of that Sage
installation, otherwise known as the SAGE_ROOT of that installation. When we run tests, we use that particular
Sage installation via the syntax ./sage; notice the “dot-forward-slash” at the front of sage. This is a precaution
against confusion that can arise when our system has multiple Sage installations. For example, the following syntax is
acceptable because we explicitly specify the Sage installation in the current SAGE_ROOT:
[jdemeyer@sage sage-6.0]$ ./sage -t src/sage/games/sudoku.py
Running doctests with ID 2012-07-03-03-43-24-a3449f54.
Doctesting 1 file.
sage -t src/sage/games/sudoku.py
[103 tests, 3.6 s]
-----------------------------------------------------------------------All tests passed!
-----------------------------------------------------------------------Total time for all tests: 4.9 seconds
cpu time: 3.6 seconds
cumulative wall time: 3.6 seconds
[jdemeyer@sage sage-6.0]$ ./sage -t "src/sage/games/sudoku.py"
Running doctests with ID 2012-07-03-03-43-54-ac8ca007.
Doctesting 1 file.
sage -t src/sage/games/sudoku.py
[103 tests, 3.6 s]
-----------------------------------------------------------------------All tests passed!
-----------------------------------------------------------------------Total time for all tests: 4.9 seconds
cpu time: 3.6 seconds
cumulative wall time: 3.6 seconds
The following syntax is not recommended as we are using a system-wide Sage installation (if it exists):
[jdemeyer@sage sage-6.0]$ sage -t src/sage/games/sudoku.py
sage -t "src/sage/games/sudoku.py"
**********************************************************************
File "/home/jdemeyer/sage/sage-6.0/src/sage/games/sudoku.py", line 515:
sage: next(h.solve(algorithm=’backtrack’))
Exception raised:
Traceback (most recent call last):
File "/usr/local/sage/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/usr/local/sage/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/usr/local/sage/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_13[4]>", line 1, in <module>
next(h.solve(algorithm=’backtrack’))###line 515:
sage: next(h.solve(algorithm=’backtrack’))
File "/home/jdemeyer/.sage/tmp/sudoku.py", line 607, in solve
for soln in gen:
File "/home/jdemeyer/.sage/tmp/sudoku.py", line 719, in backtrack
from sudoku_backtrack import backtrack_all
ImportError: No module named sudoku_backtrack
**********************************************************************
[...more errors...]
2 items had failures:
4 of 15 in __main__.example_13
58
Chapter 3. Writing Code for Sage