How to run a test file?

asked 2022-06-30 21:57:27 +0100

raine gravatar image

updated 2022-07-03 03:53:03 +0100

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!

edit retag flag offensive close merge delete

Comments

Instead of

./sage test_nucomp_timing.py

try

./sage -t test_nucomp_timing.py
slelievre gravatar imageslelievre ( 2022-07-04 08:11:49 +0100 )edit