On Sat, Apr 19, 2008 at 9:34 PM, Timothy Clemans
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm using Sage to doctest the code I've written for a new external
> project that I started. Currently I have to put ">>> from table import
> *" at the top of each of my doctest blocks. I don't want to have to
> add and remove this line before each release especially as my code
> base enlarges.
>
> I'm requesting that the Sage frontend to Python's doctest framework be
> made more intelligent when dealing with external files and projects.
> For example, maybe if a file is outside the Sage code base, then the
> frontend would add "from blah import *" to each doctest block
> automatically where blah is the file name minus the filetype
> identifier.
>
> Timothy
Perhaps you could just use Python's standard doctesting framework
since you're using >>> instead of sage:, etc., and hence not
using the Sage preparser, and maybe not the Sage library?
E.g., put something like this at the bottom of your file and run
it is as a script. This is the canonical thing to do for general
Python code, and it's described in the Python doctest documentation.
if __name__ == '__main__':
import doctest, sys
s = doctest.testmod(sys.modules[__name__],
optionflags=doctest.NORMALIZE_WHITESPACE
|doctest.ELLIPSIS,
verbose=False)
sys.exit(s[0])
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---