On Tue, Mar 31, 2009 at 9:34 AM, John Cremona <john.crem...@gmail.com> wrote: > > Suppose I have just written a whole lot of new functions in a .py file > outside the main source tree, complete with doctests. How can I test > these using sage -t, given that the file needs to be loaded or > attached for the functions to be visible? Do I have to actually put > the file somewhere in the source tree and add it to the appropriate > all.py before I can do this? >
Remember that bug with absolute paths and "sage -t" that David Loeffler mentioned recently? Well in sage-3.4.1.alpha0, at least, if you doctest foo.py outside the tree, then "from foo import *" is done first. E.g., wst...@sage:~/build/sage-3.4.1.alpha0$ more a.py def f(n): """ sage: print f(3) 5 """ return 4 wst...@sage:~/build/sage-3.4.1.alpha0$ ./sage -t a.py sage -t "a.py" ********************************************************************** File "/scratch/wstein/build/sage-3.4.1.alpha0/a.py", line 3: sage: print f(3) Expected: 5 Got: 4 ********************************************************************** 1 items had failures: 1 of 3 in __main__.example_0 ***Test Failed*** 1 failures. For whitespace errors, see the file ./.doctest_a.py [1.0 s] exit code: 1024 ---------------------------------------------------------------------- The following tests failed: sage -t "a.py" Total time for all tests: 1.0 seconds wst...@sage:~/build/sage-3.4.1.alpha0$ Notice above that f *is* defined! william --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---