Can doctests require gcc? (#13533)

34 views
Skip to first unread message

Jeroen Demeyer

unread,
Sep 26, 2012, 4:30:03 AM9/26/12
to sage-devel
Currently, there are quite some doctests in Sage requiring a C compiler
(or a C++ or Fortran compiler). Only a few of these are marked "#
optional - gcc". I would like to make gcc a requirement for doctests
and therefore remove "# optional - gcc".

I see several reasons:

1) Increasing testing. If those doctests are not marked optional, they
will always be run so we will see when something breaks. See #12446 for
example for an optional doctest broken because of this.

2) Uniformity. Either all gcc-requiring tests are marked optional, or
none is.

3) Everybody has gcc anyway. A user which doesn't have a compiler
toolchain installed on his computer is unlikely to be a Sage developer.
Hence, unlikely to run all doctests in Sage.

I have opened ticket
http://trac.sagemath.org/sage_trac/ticket/13533
to remove all "# optional - gcc" from the relevant doctests, it needs
review.


Jeroen.

Robert Bradshaw

unread,
Sep 26, 2012, 4:51:24 AM9/26/12
to sage-...@googlegroups.com
While a C compiler is certainly useful for using as well as developing
Sage, I'd rather gcc remain optional to increase the chances that a
pure binary install can run and pass all tests. On this note, however,
I would propose the more radical change of automatically detecting
which optional tests to run and running them by default. This would
have all of the benefits of removing the optional markers and none of
the drawbacks.

- Robert

Jeroen Demeyer

unread,
Sep 26, 2012, 4:56:28 AM9/26/12
to sage-...@googlegroups.com
On 2012-09-26 10:51, Robert Bradshaw wrote:
> While a C compiler is certainly useful for using as well as developing
> Sage, I'd rather gcc remain optional to increase the chances that a
> pure binary install can run and pass all tests.
So you would be in favour of marking all compiler-requiring tests
"optional"? (me not, because things which aren't tested tend to break)

> I would propose the more radical change of automatically detecting
> which optional tests to run and running them by default. This would
> have all of the benefits of removing the optional markers and none of
> the drawbacks.
Sure, but this doesn't exist yet, and I prefer not to assume anything
about the future existence of such a feature.

Volker Braun

unread,
Sep 26, 2012, 6:11:04 AM9/26/12
to sage-...@googlegroups.com
One question is how to implement this, especially since the optional Sage library code might only be imported if one tries to run the optional test. So it seem that static code analysis isn't sufficient here. Also, right now it is clear from the docstring what you need to run an optional doctest, and any automatic system needs to provide a clear error message to the user instead of some obscure backtrace.

We could implement a special OptionalPackageMissing exception and all Sage library code that optional code has to raise if their dependency is missing. Perhaps subclassing the exception for each optional package.

Either way, I don't mind seeing the optional - gcc go away.

Robert Bradshaw

unread,
Sep 26, 2012, 1:24:26 PM9/26/12
to sage-...@googlegroups.com
On Wed, Sep 26, 2012 at 3:11 AM, Volker Braun <vbrau...@gmail.com> wrote:
> One question is how to implement this, especially since the optional Sage
> library code might only be imported if one tries to run the optional test.
> So it seem that static code analysis isn't sufficient here. Also, right now
> it is clear from the docstring what you need to run an optional doctest, and
> any automatic system needs to provide a clear error message to the user
> instead of some obscure backtrace.
>
> We could implement a special OptionalPackageMissing exception and all Sage
> library code that optional code has to raise if their dependency is missing.
> Perhaps subclassing the exception for each optional package.

I was imagining something much simpler. The doctest framework would
know about several of the optional tags, along with how to detect them
(e.g. it could simply see if gcc, magma, etc. is in the path). Unknown
optional flags would simply remain off.
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To post to this group, send email to sage-...@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-devel+...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>
>

Julien Puydt

unread,
Sep 26, 2012, 2:05:43 PM9/26/12
to sage-...@googlegroups.com
Le 26/09/2012 19:24, Robert Bradshaw a �crit :
> I was imagining something much simpler. The doctest framework would
> know about several of the optional tags, along with how to detect them
> (e.g. it could simply see if gcc, magma, etc. is in the path). Unknown
> optional flags would simply remain off.

That sounds nice!

Snark on #sagemath

Jeroen Demeyer

unread,
Sep 27, 2012, 3:48:07 AM9/27/12
to sage-...@googlegroups.com
On 2012-09-26 10:51, Robert Bradshaw wrote:
> While a C compiler is certainly useful for using as well as developing
> Sage, I'd rather gcc remain optional to increase the chances that a
> pure binary install can run and pass all tests.
I cannot remember anybody ever complaining that not all doctests pass
without a compiler toolchain. So I find this potential advantage much
less than the disadvantage of not testing inline cython() commands in
doctests.

> I would propose the more radical change of automatically detecting
> which optional tests to run and running them by default. This would
> have all of the benefits of removing the optional markers and none of
> the drawbacks.
Robert, given that *currently* such a feature doesn't exist, would you
*currently* prefer to
A) remove optional - gcc everywhere
or
B) add optional - GCC where needed


Jeroen.

Robert Bradshaw

unread,
Sep 27, 2012, 5:22:57 AM9/27/12
to sage-...@googlegroups.com
(B) with trac ticket #13540

- Robert
Reply all
Reply to author
Forward
0 new messages