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.Mon, 04 Jul 2022 08:11:49 +0200How to run a test file?https://ask.sagemath.org/question/63075/how-to-run-a-test-file/Hello, I'm trying to run a test file, test_nucomp_timing.py, that tests the functionality of another file in sage's source code. test_nucomp_timing.py itself is not in sage's source code, but the file I'm testing is. Where should I put the test file, and which command should I use in order to run it? So far what I've tried is putting the file in sage's src folder and running the command "./sage test_nucomp_timing.py", but the first line of the test file is "from sage.schemes.hyperelliptic_curves import jacobian_morphism", which produces this error:
Traceback (most recent call last):
File "/mnt/c/Users/Raine/sage/test_nucomp_timing.py", line 1, in <module>
from sage.schemes.hyperelliptic_curves import jacobian_morphism
File "/mnt/c/Users/Raine/sage/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py", line 119, in <module>
from sage.schemes.generic.morphism import SchemeMorphism
File "/mnt/c/Users/Raine/sage/src/sage/schemes/generic/morphism.py", line 84, in <module>
from sage.rings.fraction_field_element import FractionFieldElement
File "sage/rings/fraction_field_element.pyx", line 26, in init sage.rings.fraction_field_element
File "sage/rings/integer_ring.pyx", line 1, in init sage.rings.integer_ring
File "sage/rings/integer.pyx", line 1, in init sage.rings.integer
File "sage/rings/rational.pyx", line 79, in init sage.rings.rational
ImportError: cannot import name ZZ
Is there anything I haven't set up properly? Thank you!Thu, 30 Jun 2022 21:57:27 +0200https://ask.sagemath.org/question/63075/how-to-run-a-test-file/Comment by slelievre for <p>Hello, I'm trying to run a test file, test_nucomp_timing.py, that tests the functionality of another file in sage's source code. test_nucomp_timing.py itself is not in sage's source code, but the file I'm testing is. Where should I put the test file, and which command should I use in order to run it? So far what I've tried is putting the file in sage's src folder and running the command "./sage test_nucomp_timing.py", but the first line of the test file is "from sage.schemes.hyperelliptic_curves import jacobian_morphism", which produces this error:</p>
<pre><code>Traceback (most recent call last):
File "/mnt/c/Users/Raine/sage/test_nucomp_timing.py", line 1, in <module>
from sage.schemes.hyperelliptic_curves import jacobian_morphism
File "/mnt/c/Users/Raine/sage/src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py", line 119, in <module>
from sage.schemes.generic.morphism import SchemeMorphism
File "/mnt/c/Users/Raine/sage/src/sage/schemes/generic/morphism.py", line 84, in <module>
from sage.rings.fraction_field_element import FractionFieldElement
File "sage/rings/fraction_field_element.pyx", line 26, in init sage.rings.fraction_field_element
File "sage/rings/integer_ring.pyx", line 1, in init sage.rings.integer_ring
File "sage/rings/integer.pyx", line 1, in init sage.rings.integer
File "sage/rings/rational.pyx", line 79, in init sage.rings.rational
ImportError: cannot import name ZZ
</code></pre>
<p>Is there anything I haven't set up properly? Thank you!</p>
https://ask.sagemath.org/question/63075/how-to-run-a-test-file/?comment=63100#post-id-63100Instead of
./sage test_nucomp_timing.py
try
./sage -t test_nucomp_timing.pyMon, 04 Jul 2022 08:11:49 +0200https://ask.sagemath.org/question/63075/how-to-run-a-test-file/?comment=63100#post-id-63100