William Stein wrote:
> On Tue, Apr 15, 2008 at 9:11 AM, Jason Bandlow <[EMAIL PROTECTED]> wrote:
>
>> Hello all,
>>
>> Regarding doctesting, I'd like to work with the following setup:
>> 1. Create a file work.sage (or work.py) somewhere in my home directory.
>> 2. Start a notebook session, and attach work.sage.
>> 3. Use the notebook for generating and staring at data, while using a
>> text editor to modify my code.
>> 4. Periodically run: $ sage -t work.sage to make sure that I
>> haven't completely fouled things up.
>>
>> Step 4 seems not to work (on Sage 2.11 on Ubuntu). For example,
>> I created the following file, foo.py, in my ~/.sage directory:
>>
>
> As a workaround do not put foo.py in .sage; put it in *any*
> other directory that does not start with a dot. Then everything
> should work fine.
>
> -- William
>
>
Thanks! That seems to work. However the following is an annoyance:
If the file has extension ".sage", sage -t works great, but sage
-coverage does nothing. If the file has extension ".py", sage -coverage
works well, but sage -t fails to find the methods in the file (an
example is below). This isn't a big deal for me, since I tend to work
with .sage files and I can find the coverage by hand, but it still seems
worth mentioning.
Example:
[EMAIL PROTECTED]:~$ more good.sage
def foo(x):
r"""
Shows how doctests don't work.
EXAMPLES:
sage: foo(3)
3
"""
print x
[EMAIL PROTECTED]:~$ sage -t good.sage
sage -t good.sage
Example 0 (line 5)
[2.6 s]
----------------------------------------------------------------------
All tests passed!
Total time for all tests: 2.6 seconds
[EMAIL PROTECTED]:~$ cp good.sage good.py
[EMAIL PROTECTED]:~$ sage -t good.py
sage -t good.py
**********************************************************************
File "good.py", line 6:
sage: foo(3)
Exception raised:
Traceback (most recent call last):
File "/home/jason/sage/local/lib/python2.5/doctest.py", line 1212,
in __run
compileflags, 1) in test.globs
File "<doctest __main__.example_0[0]>", line 1, in <module>
foo(Integer(3))###line 6:
sage: foo(3)
NameError: name 'foo' is not defined
**********************************************************************
1 items had failures:
1 of 1 in __main__.example_0
***Test Failed*** 1 failures.
For whitespace errors, see the file .doctest_good.py
[1.7 s]
exit code: 1024
----------------------------------------------------------------------
The following tests failed:
sage -t good.py
Total time for all tests: 1.7 seconds
Cheers,
Jason
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---