Unfortunately this does not work for me:

mas...@host-56-150%pwd
/home/masgaj/sage
mas...@host-56-150%ls -l egros.py
-rw------- 1 masgaj ma 16242 2009-04-01 12:09 egros.py
mas...@host-56-150%sage -t /home/masgaj/sage/egros.py
sage -t  "/home/masgaj/sage/egros.py"
  File "./egros.py", line 18
    from /home/masgaj/sage/egros import *
         ^
SyntaxError: invalid syntax

         [0.2 s]
exit code: 1024

----------------------------------------------------------------------
The following tests failed:


        sage -t  "/home/masgaj/sage/egros.py"
Total time for all tests: 0.2 seconds

If I give just the file name (as in : sage -t egros.py) then it is
even worse, starting with
   NameError: global name 'QQ' is not defined

This is with 3.4.1.alpha0 after cloning and applying one patch.

John

2009/3/31 William Stein <wst...@gmail.com>:
>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to