[sage-devel] Help needed with TestSuite

11 views
Skip to first unread message

Andrey Novoseltsev

unread,
May 16, 2010, 12:52:46 PM5/16/10
to sage-devel
Hello,

If I add a new file into Sage without TestSuite(...).run(), then "sage
-coverage" shows an "ERROR" for this file. Does this mean that a patch
without such a test has no chances to be merged? I really hope this is
not the case yet...

I think that TestSuite is an awesome idea and it did help me to fix
some potential bugs. However when I derive from existing classes that
have no TestSuite testing, it seems that my class is blamed for all
the errors and inconsistencies of these existing classes. Of course,
they also should be fixed, but it may not be very clear how.

In particular, can anyone give me a hint what should I do with the
following (my class has the same error):

P2 = ProjectiveSpace(2, QQ)
e = P2(1,1,1)
e._test_category()

Traceback (most recent call last):
...
File "element.pyx", line 472, in
sage.structure.element.Element._test_category (sage/structure/
element.c:3676)
File "/home/novoselt/sage/local/lib/python/unittest.py", line 325,
in failUnless
if not expr: raise self.failureException, msg
AssertionError

I have also discovered that even this fails (in Sage 4.4):

TestSuite(QQ[x]).run()

Thank you!
Andrey

--
To post to this group, send an email to sage-...@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

John Cremona

unread,
May 16, 2010, 1:15:45 PM5/16/10
to sage-...@googlegroups.com
I had noticed that, after bringing a coupld of files up to 100%
coverage, it was annoying to get this Error message.

There seems to be nothing about TestSuite in the developers guide, so
it cannot (yet) be a requirement to implement it!

After trying TestSuite? I found the page in the reference manual
(under Miscellaneous, in the section Unit testing for Sage objects).
But if this is intended to be a requirement, or even a desirable
feature of every Sage class, there needs to be some better instruction
on what to do.

John

Andrey Novoseltsev

unread,
May 16, 2010, 1:31:30 PM5/16/10
to sage-devel
Thank you, you made my day!

Andrey

On May 16, 11:15 am, John Cremona <john.crem...@gmail.com> wrote:
> I had noticed that, after bringing a coupld of files up to 100%
> coverage, it was annoying to get this Error message.
>
> There seems to be nothing about TestSuite in the developers guide, so
> it cannot (yet) be a requirement to implement it!
>
> After  trying TestSuite? I found the page in the reference manual
> (under Miscellaneous, in the section Unit testing for Sage objects).
> But if this is intended to be a requirement, or even a desirable
> feature of every Sage class, there needs to be some better instruction
> on what to do.
>
> John
>
> > For more options, visit this group athttp://groups.google.com/group/sage-devel
> > URL:http://www.sagemath.org
>
> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group athttp://groups.google.com/group/sage-devel

Nicolas M. Thiery

unread,
Mar 4, 2011, 5:32:23 AM3/4/11
to sage-...@googlegroups.com
Hi Andrey, John!

I somehow never received this discussion of yours on sage-devel, and
stumbled on it while browsing trac. Time to answer!

> Sometime in May 2010, John said on sage-devel:

> I had noticed that, after bringing a coupld of files up to 100%
> coverage, it was annoying to get this Error message.
>
> There seems to be nothing about TestSuite in the developers guide, so
> it cannot (yet) be a requirement to implement it!
>
> After �trying TestSuite? I found the page in the reference manual
> (under Miscellaneous, in the section Unit testing for Sage objects).
> But if this is intended to be a requirement, or even a desirable
> feature of every Sage class, there needs to be some better instruction
> on what to do.

The coverage script previously requested a loads/dumps test, and I
replaced it by a TestSuite test. My point of view is indeed that every
class implemented in Sage should be tested with a TestSuite run.

Now I totally agree that it is very annoying when working hard to
improve the test coverage for a class to get "blamed" for all the
issues that the TestSuite call uncovers. So in such a situation, I
find totally acceptable to use:

sage: TestSuite(S).run(skip = ["_test_blah", "_test_blih"]) # see trac #10307

where #10307 would be a new ticket requesting to fix the failing test
in a later patch. Sage is better off with a new TestSuite call that:

- documents what does not work yet and feels itchy, which is good:
someone will eventually want to scratch that itch
- is ready to catch other regressions

than without.

John: do you see a good place in the developpers manual where to add
the above comments?

Cheers,
Nicolas
--
Nicolas M. Thi�ry "Isil" <nth...@users.sf.net>
http://Nicolas.Thiery.name/

Reply all
Reply to author
Forward
0 new messages