Ask Your Question
0

How to test all but a couple files

asked 2011-03-15 10:10:03 +0100

kcrisman gravatar image

It's fun and easy to test the Sage library by directory.

./sage -t devel/sage/sage/module_1/

The same is true if you only need to test a couple files.

./sage -t devel/sage/sage/module_1/foo.py devel/sage/sage/module_1/bar.py

But it's not so fun and easy to test all but a couple files in a module. Here, I test all but the last file in a module. Imagine $n>4$, and the names not being so easy to write down.

./sage -t devel/sage/sage/module_1/file_1.py devel/sage/sage/module_1/file_2.py <snip> devel/sage/sage/module_1/file_n-1.py

What I want to know is whether there is an easy way to do the above, along the lines of

./sage -t devel/sage/sage/module_1/ -not devel/sage/sage/module_1/file_n.py

Probably one can write some script asking not to test that, or whatever, but that is too much work, because I'd constantly be writing scripts. Is there any way to massage the arguments to ./sage -t to do this easily?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-03-15 10:33:48 +0100

DSM gravatar image

If you use bash (with extglob on), you could write something like

./sage -t devel/sage/sage/misc/c!(ache*).py

which picks up

localhost:$ ls -1 devel/sage/sage/misc/c!(ache*).py
devel/sage/sage/misc/classcall_metaclass.py
devel/sage/sage/misc/classgraph.py
devel/sage/sage/misc/constant_function.py
devel/sage/sage/misc/copying.py
devel/sage/sage/misc/cython.py

or

localhost:$ ls devel/sage/sage/sets/!(integer_range|positive_integers).py
devel/sage/sage/sets/__init__.py            devel/sage/sage/sets/finite_enumerated_set.py
devel/sage/sage/sets/all.py             devel/sage/sage/sets/non_negative_integers.py
devel/sage/sage/sets/cartesian_product.py       devel/sage/sage/sets/primes.py
devel/sage/sage/sets/disjoint_union_enumerated_sets.py  devel/sage/sage/sets/set.py
devel/sage/sage/sets/family.py

etc.

edit flag offensive delete link more

Comments

I can't edit your reply, but this is the bomb! Please put in that you need to do `shopt -s extglob` to enable this, and `shopt -u extglob` to disable afterwards (see http://stackoverflow.com/questions/216995/how-can-i-use-negative-wildcards-in-a-unix-linux-shell).

kcrisman gravatar imagekcrisman ( 2011-03-15 11:55:31 +0100 )edit

THEN please open a ticket to add this to the doctesting section of the developer guide, and cc: me and Minh and maybe anyone else who cares about the developer guide (Rob B?). This is an extremely useful trick.

kcrisman gravatar imagekcrisman ( 2011-03-15 11:56:36 +0100 )edit

And now I put you above my karma by clicking that this answers the question ;-)

kcrisman gravatar imagekcrisman ( 2011-03-15 11:58:56 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-03-15 10:10:03 +0100

Seen: 477 times

Last updated: Mar 15 '11