ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 15 Mar 2011 11:58:56 +0100How to test all but a couple fileshttps://ask.sagemath.org/question/8000/how-to-test-all-but-a-couple-files/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?Tue, 15 Mar 2011 10:10:03 +0100https://ask.sagemath.org/question/8000/how-to-test-all-but-a-couple-files/Answer by DSM for <p>It's fun and easy to test the Sage library by directory.</p>
<pre><code>./sage -t devel/sage/sage/module_1/
</code></pre>
<p>The same is true if you only need to test a couple files.</p>
<pre><code>./sage -t devel/sage/sage/module_1/foo.py devel/sage/sage/module_1/bar.py
</code></pre>
<p>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.</p>
<pre><code>./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
</code></pre>
<p>What I want to know is whether there is an easy way to do the above, along the lines of </p>
<pre><code>./sage -t devel/sage/sage/module_1/ -not devel/sage/sage/module_1/file_n.py
</code></pre>
<p>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 <code>./sage -t</code> to do this easily?</p>
https://ask.sagemath.org/question/8000/how-to-test-all-but-a-couple-files/?answer=12190#post-id-12190If 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.Tue, 15 Mar 2011 10:33:48 +0100https://ask.sagemath.org/question/8000/how-to-test-all-but-a-couple-files/?answer=12190#post-id-12190Comment by kcrisman for <p>If you use bash (with extglob on), you could write something like</p>
<pre><code>./sage -t devel/sage/sage/misc/c!(ache*).py
</code></pre>
<p>which picks up</p>
<pre><code>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
</code></pre>
<p>or </p>
<pre><code>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
</code></pre>
<p>etc.</p>
https://ask.sagemath.org/question/8000/how-to-test-all-but-a-couple-files/?comment=21991#post-id-21991THEN 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.Tue, 15 Mar 2011 11:56:36 +0100https://ask.sagemath.org/question/8000/how-to-test-all-but-a-couple-files/?comment=21991#post-id-21991Comment by kcrisman for <p>If you use bash (with extglob on), you could write something like</p>
<pre><code>./sage -t devel/sage/sage/misc/c!(ache*).py
</code></pre>
<p>which picks up</p>
<pre><code>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
</code></pre>
<p>or </p>
<pre><code>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
</code></pre>
<p>etc.</p>
https://ask.sagemath.org/question/8000/how-to-test-all-but-a-couple-files/?comment=21993#post-id-21993I 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). Tue, 15 Mar 2011 11:55:31 +0100https://ask.sagemath.org/question/8000/how-to-test-all-but-a-couple-files/?comment=21993#post-id-21993Comment by kcrisman for <p>If you use bash (with extglob on), you could write something like</p>
<pre><code>./sage -t devel/sage/sage/misc/c!(ache*).py
</code></pre>
<p>which picks up</p>
<pre><code>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
</code></pre>
<p>or </p>
<pre><code>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
</code></pre>
<p>etc.</p>
https://ask.sagemath.org/question/8000/how-to-test-all-but-a-couple-files/?comment=21990#post-id-21990And now I put you above my karma by clicking that this answers the question ;-)Tue, 15 Mar 2011 11:58:56 +0100https://ask.sagemath.org/question/8000/how-to-test-all-but-a-couple-files/?comment=21990#post-id-21990