#12341: Empty (full) cremona database in Sage 4.8 causes tests to fail
-------------------------------+--------------------------------------------
   Reporter:  swenson          |          Owner:  cremona        
       Type:  defect           |         Status:  needs_review   
   Priority:  critical         |      Milestone:  sage-5.0       
  Component:  elliptic curves  |       Keywords:                 
Work_issues:                   |       Upstream:  N/A            
   Reviewer:  John Cremona     |         Author:  R. Andrew Ohana
     Merged:                   |   Dependencies:                 
-------------------------------+--------------------------------------------

Old description:

> I am on Ubuntu 11.10, and noticed that a fresh install of Sage 4.8 fails
> a bunch of tests because the full cremona database is an empty file by
> default.
>
> {{{
> [swenson@harry 10:18:14] sage-4.8 :) $ ./sage -t /home/swenson/sage-
> src/sage-4.8/devel/sage-main/sage/misc/functional.py
> (hg)-[default]-
> sage -t  "devel/sage-main/sage/misc/functional.py"
> #0: simplify_sum(expr='sum(q^k,k,0,inf))
> #1: simplify_sum(expr=a*'sum(q^k,k,0,inf))
> **********************************************************************
> File "/home/swenson/sage-src/sage-4.8/devel/sage-
> main/sage/misc/functional.py", line 1360:
>     sage: regulator(EllipticCurve('11a'))
> Exception raised:
>     Traceback (most recent call last):
>       File "/home/swenson/sage-src/sage-4.8/local/bin/ncadoctest.py",
> line 1231, in run_one_test
>         self.run_one_example(test, example, filename, compileflags)
>       File "/home/swenson/sage-src/sage-4.8/local/bin/sagedoctest.py",
> line 38, in run_one_example
>         OrigDocTestRunner.run_one_example(self, test, example, filename,
> compileflags)
>       File "/home/swenson/sage-src/sage-4.8/local/bin/ncadoctest.py",
> line 1172, in run_one_example
>         compileflags, 1) in test.globs
>       File "<doctest __main__.example_54[3]>", line 1, in <module>
>         regulator(EllipticCurve('11a'))###line 1360:
>     sage: regulator(EllipticCurve('11a'))
>       File "/home/swenson/sage-src/sage-4.8/local/lib/python/site-
> packages/sage/schemes/elliptic_curves/constructor.py", line 295, in
> EllipticCurve
>         return ell_rational_field.EllipticCurve_rational_field(x)
>       File "/home/swenson/sage-src/sage-4.8/local/lib/python/site-
> packages/sage/schemes/elliptic_curves/ell_rational_field.py", line 198,
> in __init__
>         X = sage.databases.cremona.CremonaDatabase()[label]
>       File "/home/swenson/sage-src/sage-4.8/local/lib/python/site-
> packages/sage/databases/cremona.py", line 1363, in CremonaDatabase
>         _db = LargeCremonaDatabase(name)
>       File "/home/swenson/sage-src/sage-4.8/local/lib/python/site-
> packages/sage/databases/cremona.py", line 1119, in __init__
>         + 'not appear to be a valid SQL Cremona database.')
>     RuntimeError: Database at /home/swenson/sage-
> src/sage-4.8/data//cremona/cremona.db does not appear to be a valid SQL
> Cremona database.
> **********************************************************************
> 1 items had failures:
>    1 of   5 in __main__.example_54
> ***Test Failed*** 1 failures.
> For whitespace errors, see the file
> /home/swenson/.sage//tmp/functional_29532.py
>          [4.3 s]
>
> ----------------------------------------------------------------------
> The following tests failed:
>

>         sage -t  "devel/sage-main/sage/misc/functional.py"
> Total time for all tests: 4.3 seconds
> [swenson@harry 10:18:22] sage-4.8 :( $ rm /home/swenson/sage-
> src/sage-4.8/data/cremona/cremona.db
> (hg)-[default]-
> [swenson@harry 10:18:25] sage-4.8 :) $ ./sage -t /home/swenson/sage-
> src/sage-4.8/devel/sage-main/sage/misc/functional.py
> (hg)-[default]-
> sage -t  "devel/sage-main/sage/misc/functional.py"
>          [4.3 s]
>
> ----------------------------------------------------------------------
> All tests passed!
> Total time for all tests: 4.3 seconds
> }}}

New description:

 I am on Ubuntu 11.10, and noticed that a fresh install of Sage 4.8 fails a
 bunch of tests because the full cremona database is an empty file by
 default.

 {{{
 [swenson@harry 10:18:14] sage-4.8 :) $ ./sage -t /home/swenson/sage-
 src/sage-4.8/devel/sage-main/sage/misc/functional.py
 (hg)-[default]-
 sage -t  "devel/sage-main/sage/misc/functional.py"
 #0: simplify_sum(expr='sum(q^k,k,0,inf))
 #1: simplify_sum(expr=a*'sum(q^k,k,0,inf))
 **********************************************************************
 File "/home/swenson/sage-src/sage-4.8/devel/sage-
 main/sage/misc/functional.py", line 1360:
     sage: regulator(EllipticCurve('11a'))
 Exception raised:
     Traceback (most recent call last):
       File "/home/swenson/sage-src/sage-4.8/local/bin/ncadoctest.py", line
 1231, in run_one_test
         self.run_one_example(test, example, filename, compileflags)
       File "/home/swenson/sage-src/sage-4.8/local/bin/sagedoctest.py",
 line 38, in run_one_example
         OrigDocTestRunner.run_one_example(self, test, example, filename,
 compileflags)
       File "/home/swenson/sage-src/sage-4.8/local/bin/ncadoctest.py", line
 1172, in run_one_example
         compileflags, 1) in test.globs
       File "<doctest __main__.example_54[3]>", line 1, in <module>
         regulator(EllipticCurve('11a'))###line 1360:
     sage: regulator(EllipticCurve('11a'))
       File "/home/swenson/sage-src/sage-4.8/local/lib/python/site-
 packages/sage/schemes/elliptic_curves/constructor.py", line 295, in
 EllipticCurve
         return ell_rational_field.EllipticCurve_rational_field(x)
       File "/home/swenson/sage-src/sage-4.8/local/lib/python/site-
 packages/sage/schemes/elliptic_curves/ell_rational_field.py", line 198, in
 __init__
         X = sage.databases.cremona.CremonaDatabase()[label]
       File "/home/swenson/sage-src/sage-4.8/local/lib/python/site-
 packages/sage/databases/cremona.py", line 1363, in CremonaDatabase
         _db = LargeCremonaDatabase(name)
       File "/home/swenson/sage-src/sage-4.8/local/lib/python/site-
 packages/sage/databases/cremona.py", line 1119, in __init__
         + 'not appear to be a valid SQL Cremona database.')
     RuntimeError: Database at /home/swenson/sage-
 src/sage-4.8/data//cremona/cremona.db does not appear to be a valid SQL
 Cremona database.
 **********************************************************************
 1 items had failures:
    1 of   5 in __main__.example_54
 ***Test Failed*** 1 failures.
 For whitespace errors, see the file
 /home/swenson/.sage//tmp/functional_29532.py
          [4.3 s]

 ----------------------------------------------------------------------
 The following tests failed:


         sage -t  "devel/sage-main/sage/misc/functional.py"
 Total time for all tests: 4.3 seconds
 [swenson@harry 10:18:22] sage-4.8 :( $ rm /home/swenson/sage-
 src/sage-4.8/data/cremona/cremona.db
 (hg)-[default]-
 [swenson@harry 10:18:25] sage-4.8 :) $ ./sage -t /home/swenson/sage-
 src/sage-4.8/devel/sage-main/sage/misc/functional.py
 (hg)-[default]-
 sage -t  "devel/sage-main/sage/misc/functional.py"
          [4.3 s]

 ----------------------------------------------------------------------
 All tests passed!
 Total time for all tests: 4.3 seconds
 }}}

 ----

 See comment:14 for an explanation of the issues causing this.

 ----

 Apply attachment:trac12341.patch to the Sage Library.

--

Comment(by rohana):

 Replying to [comment:13 cremona]:
 > I have not checked all the logic in the revised code.

 I don't think I have explained the issue that this ticket fixes very
 clearly (which was exposed when running one of the optional doctests
 without having the optional spkg installed). There are 2 main issues that
 caused this:

  * When calling `CremonaDatabase('name')` the file
 `SAGE_ROOT/data/cremona/name.db` was being touched, something that is bad
 in general if the file wasn't there to start with.

  * When calling `CremonaDatabase()`, to determine if the full database is
 installed, it would check for the existence of
 `SAGE_ROOT/data/cremona/cremona.db` rather than use one of the functions
 in `sage.misc` for this purpose.

 With these combined, running the optional doctests would break the cremona
 database: it would run `CremonaDatabase('cremona')`, which would touch
 `SAGE_ROOT/data/cremona/cremona.db` and thus later calls of
 `CremonaDatabase()` would break since it would think the full cremona
 database was installed and try to use the touched file.

 > I was puzzled by the remark about testing with flag --optional since I
 thought that only made sense with some sensible string after the word
 "optional", e.g. "magma".

 Unless you want to test all optional packages (which could be useful for a
 giant system install -- unfortunately there are a few optional packages
 that don't want to build properly at the moment).

 > But it seems that there are doctest lines which are tagged "# optional"
 with no mention of which optional package is relevant.

 I consider this a bug and something that should be required for any
 optional tags.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12341#comment:14>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to