only-optional

7 views
Skip to first unread message

Robert Miller

unread,
Jun 18, 2010, 6:21:05 PM6/18/10
to sage-devel
Learning about the sage -t -only-optional argument, I'm noticing that
there are quite a few modules which don't use the proper syntax. If
the doctest is followed by a

# optional -- pkg1, pkg2, pkg3

and the tester calls

sage -t [...] -only-optional=pkg4,pkg5,[...]pkg6

then the doctest will be run if {pkg1, pkg2, pkg3} is a nonempty
subset of {pkg4, pkg5, [...] pkg6}. Right now I'm fixing this in the
graphs directory, as I'm getting ready to review some LP patches. But
the list of modules for which words like "requires" and "package" will
be mistaken as required optional spkgs is rather large [1].

Another thing I notice is that there isn't any syntax available for
"run this test if one of the following packages is installed"...

sage/calculus/calculus.py
sage/categories/finite_permutation_groups.py
sage/coding/*
sage/combinat/crystals/crystals.py
sage/combinat/designs/*
sage/combinat/matrices/hadamard_matrix.py
sage/combinat/sf/sf.py
sage/combinat/sloane_functions.py
sage/crypto/mq/mpolynomialsystem.py
sage/databases/*
sage/geometry/*
sage/groups/perm_gps/*
sage/homology/*
sage/interfaces/chomp.py
sage/interfaces/expect.py
sage/interfaces/lie.py
sage/interfaces/matlab.py
sage/interfaces/octave.py
sage/misc/functional.py
sage/numerical/*
sage/plot/animate.py
sage/rings/polynomial/multi_polynomial_libsingular.pyx
sage/schemes/elliptic_curves/padic_lseries.py
sage/symbolic/expression.pyx
sage/symbolic/integration/external.py
sage/symbolic/integration/integral.py
sage/tests/benchmark.py


--
Robert L. Miller
http://www.rlmiller.org/

Robert Miller

unread,
Jun 18, 2010, 6:51:51 PM6/18/10
to sage-devel
On Jun 18, 3:21 pm, Robert Miller <r...@rlmiller.org> wrote:
> Right now I'm fixing this in the graphs directory...

See

http://trac.sagemath.org/sage_trac/ticket/9269

John H Palmieri

unread,
Jun 18, 2010, 8:21:15 PM6/18/10
to sage-devel
On Jun 18, 3:21 pm, Robert Miller <r...@rlmiller.org> wrote:
> Learning about the sage -t -only-optional argument, I'm noticing that
> there are quite a few modules which don't use the proper syntax.

Is the proper syntax documented anywhere? I can't find it. (I might
even suggest that if it's not documented, it isn't "the proper syntax"
yet.)

--
John

Robert Miller

unread,
Jun 18, 2010, 8:38:58 PM6/18/10
to sage-...@googlegroups.com
On Fri, Jun 18, 2010 at 5:21 PM, John H Palmieri <jhpalm...@gmail.com> wrote:
> Is the proper syntax documented anywhere? I can't find it.

I could only find mention of it here:

$ ./sage -advanced
...
-t [-verbose] [-long] [-optional] [-only-optional=list,of,tags] <files|dir>
-- test examples in .py, .pyx, .sage or .tex files
-long -- include lines with the phrase 'long time'
-verbose -- print debuging output during the test
-optional -- also test all #optional examples
-only-optional -- only run doctests with
#optional <nonempty subset of tags>
-randorder[=seed] -- randomize order of tests
...

John H Palmieri

unread,
Jun 18, 2010, 10:55:43 PM6/18/10
to sage-devel
On Jun 18, 5:38 pm, Robert Miller <r...@rlmiller.org> wrote:
> On Fri, Jun 18, 2010 at 5:21 PM, John H Palmieri <jhpalmier...@gmail.com> wrote:
>
> > Is the proper syntax documented anywhere?  I can't find it.

Okay, see

http://trac.sagemath.org/sage_trac/ticket/9270

for documentation. I hope I have it right. See

http://trac.sagemath.org/sage_trac/ticket/9271

for a clean-up of the homology directory. This "-only-optional" flag
is a bit buggy: the doctests (after patching) are marked "# optional -
CHomP", and they get run if I do "-only-optional=chomp", but *not* if
I do "-only-optional=CHomP". (See #9272 for this problem: no fix yet,
just reporting the problem.)

--
John

David Kirkby

unread,
Jun 19, 2010, 3:23:32 AM6/19/10
to sage-...@googlegroups.com

Are not all packages in Sage referred to by the lower case names?
polybori should be written as PolyBoRi, but the standard package in
Sage is all lower case. For consistency, it might be better to keep it
that way for optional and experimental packages.

Dave

John H Palmieri

unread,
Jun 19, 2010, 11:04:24 AM6/19/10
to sage-devel
On Jun 19, 12:23 am, David Kirkby <david.kir...@onetel.net> wrote:
I think if I put "# optional - Gap" and then run "sage -t -only-
optional=Gap", I should expect it to find the match. I certainly
wouldn't expect "sage -t -only-optional=gap" to work while "-only-
optional=Gap" fails. It's a bug.

In fact, here's the bug: in sage-doctest, each doctest line is parsed,
and part of the parsing converts any string like "# optional - CHomP"
to all lower-case. Then it looks at the command-line arguments and
sees if "-only-optional=CHomP,GAP,..." is present, but it doesn't
convert that to all lower-case. I have a patch up now which converts
it, also. It's a one-liner, should be easy to review.

--
John
Reply all
Reply to author
Forward
0 new messages