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.Fri, 02 Aug 2019 21:03:57 +0200I just built a Sage system. What files may I delete with impunity?https://ask.sagemath.org/question/47352/i-just-built-a-sage-system-what-files-may-i-delete-with-impunity/I have just built Sage 7.6 on an Apple iMac 8,1 running OS X version 10.11.6. I started with a download of a compressed source distribution from the Sage github repository (without cloning the repository itself, since I don't plan to contribute any development ideas or comments for awhile). Doctesting went very well, with only two failed tests out of the entire suite:
sage -t src/sage/doctest/test.py # 1 doctest failed
sage -t src/sage/modules/vector_rational_dense.pyx # 1 doctest failed
I also downloaded the equivalent binary distribution and doctested that, obtaining these results:
sage -t src/sage/calculus/calculus.py # 1 doctest failed
sage -t src/sage/doctest/test.py # 1 doctest failed
sage -t src/sage/graphs/digraph_generators.py # 3 doctests failed
sage -t src/sage/graphs/graph_generators.py # 5 doctests failed
sage -t src/sage/graphs/hypergraph_generators.py # 7 doctests failed
sage -t src/sage/modules/vector_rational_dense.pyx # 1 doctest failed
sage -t src/sage/tests/cmdline.py # Timed out after testing finished
I did expect my own build to do better, but the installation I ended up with is fully 2 GB larger than what came in the binary distribution. Much (more than 1/3) of the overage is in a directory
../sage-7.6/local/share/doc/sage/doctrees
which is not present in the binary distribution, and I assume it is only of interest to developers. Is that correct? I will trim my build by also removing two large files
../sage-7.6/src/build/temp.macosx.10.9...
../sage-7.6/src/build/lib.macosx.10.9...
but keep my log and upstream files in case I want to review the build or look at the sources. All this is pending any further advice I get in the next few days about files that are generally only of interest to developers.dyne2meterFri, 02 Aug 2019 21:03:57 +0200https://ask.sagemath.org/question/47352/Why --optional=sage,optional,external does not test internet,graphviz,latex,gurobi ?https://ask.sagemath.org/question/42264/why-optionalsageoptionalexternal-does-not-test-internetgraphvizlatexgurobi/When running tests with `--optional=sage,optional,external`
$ sage -t --show-skipped --optional=sage,optional,external src/sage/graphs/graph_latex.py src/sage/databases/oeis.py src/sage/numerical/mip.pyx src/sage/misc/latex.py
the tests with labels `latex`,`gurobi`, `graphviz`, `internet` are skipped even if `latex`,`gurobi`, `graphviz`, `internet` are installed on my machine:
Running doctests with ID 2018-05-06-10-12-34-1494f13d.
Using --optional=ccache,dot2tex,external,mpir,notedown,pandoc_attributes,python2,rst2ipynb,sage
External software to be detected: cplex,gurobi,internet,latex,macaulay2,magma,maple,mathematica,matlab,octave,scilab
Doctesting 4 files.
sage -t src/sage/graphs/graph_latex.py
4 graphviz tests not run
[187 tests, 1.08 s]
sage -t src/sage/databases/oeis.py
150 internet tests not run
5 webbrowser tests not run
[118 tests, 2.28 s]
sage -t src/sage/numerical/mip.pyx
8 cplex tests not run
3 gurobi tests not run
7 other tests skipped
[616 tests, 3.69 s]
sage -t src/sage/misc/latex.py
1 imagemagick test not run
5 latex tests not run
3 other tests skipped
[315 tests, 3.00 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 11.1 seconds
cpu time: 7.5 seconds
cumulative wall time: 10.1 seconds
External software detected for doctesting: gurobi,latex
SébastienSun, 06 May 2018 10:17:34 +0200https://ask.sagemath.org/question/42264/testing sage codehttps://ask.sagemath.org/question/40887/testing-sage-code/I am having difficulty creating a convenient environment for testing. I typically use [pytest](https://docs.pytest.org/en/latest/) when programming in python. One of the nice features of pytest is that on an assertion error
assert a == b
it will tell you what the values of `a` and `b` were. I can't seem to get pytest to work with sage. Is it possible to make pytest work with sage? If not, are there other recommended testing/debugging tools to use while writing sage code? (In particular, I want to write unit tests for my code.)ml9nnTue, 30 Jan 2018 20:48:10 +0100https://ask.sagemath.org/question/40887/Test math problems to test correctness of Sagehttps://ask.sagemath.org/question/31581/test-math-problems-to-test-correctness-of-sage/To test the correctness and performance of a mathematical system like Sage, do people use a standard test data set of math problems?
If so I'd appreciate a link or reference to the data set.bubba 11220Tue, 15 Dec 2015 14:46:48 +0100https://ask.sagemath.org/question/31581/How to ensure examples in non-reference documentation test righthttps://ask.sagemath.org/question/9138/how-to-ensure-examples-in-non-reference-documentation-test-right/Consider the following rst file, called Tiny.rst, and placed somewhere in the Sage doc tree where I know that things work properly.
.. -*- coding: utf-8 -*-
Tiny Test File
==============
A command
---------
Here's an example.
::
sage: factor(2012)
2^2 * 503
Functions in Sage
-----------------
Let's do some functions.
::
sage: f(x)=x^2
sage: f(x)
x^2
Let's ask Sage what the function is one more time.
::
sage: f(x)
x^2
When I test it, regular commands and commands together test fine. But commands with user-defined things that are in another literal block don't.
sage -t devel/sage-main/doc/en/.../Tiny.rst
**********************************************************************
File "/Users/.../sage-5.1.beta5/devel/sage-main/doc/en/.../Tiny.rst", line 51:
sage: f(x)
Exception raised:
File "<doctest __main__.example_3[2]>", line 1, in <module>
f(x)###line 51:
sage: f(x)
NameError: name 'f' is not defined
**********************************************************************
1 items had failures:
1 of 4 in __main__.example_3
***Test Failed*** 1 failures.
For whitespace errors, see the file /Users/.../.sage/tmp/new_host_2.home-49485/Tiny_49488.py
[2.7 s]
----------------------------------------------------------------------
The temporary doctesting directory
/Users/.../.sage/tmp/new_host_2.home-49485
was not removed: it is not empty, presumably because doctests
failed or doctesting was interrupted.
----------------------------------------------------------------------
The following tests failed:
sage -t devel/sage-main/doc/en/.../Tiny.rst # 1 doctests failed
----------------------------------------------------------------------
Timings have been updated.
If you remove the words before the second `f(x)`, the same thing happens.
So what gives? Clearly a lot of the documentation doesn't have this issue.
kcrismanFri, 06 Jul 2012 00:04:00 +0200https://ask.sagemath.org/question/9138/trouble using import and doctest togetherhttps://ask.sagemath.org/question/7998/trouble-using-import-and-doctest-together/I have a project that contains several .py files that I want to doctest. They are interrelated and each has a few imports that load the dependencies. When I run
sage -t myfile.py
then it says that it can't find the module that myfile wants to import, even though they are in the same directory. If I put
import sys
sys.path.append(".")
at the top of every file, it works fine, provided that I run sage -t from the sage directory. This is a little annoying, is there a better way?paragonMon, 14 Mar 2011 20:30:21 +0100https://ask.sagemath.org/question/7998/How 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?kcrismanTue, 15 Mar 2011 10:10:03 +0100https://ask.sagemath.org/question/8000/Why do so many tests fail on a clean Sage installationhttps://ask.sagemath.org/question/7690/why-do-so-many-tests-fail-on-a-clean-sage-installation/With a completely clean Sage installation, performing
./sage -testall
as suggested (required) in the "Walking Through the Development Process", many doctests fail with various errors (including a few segfaults). Is this normal? If so, I'm sure that it is not intended, so is there someone with a grand overview on whether these errors are all in the process of being handled?
These errors mess up the output and makes it very difficult to sort out which are errors caused by the patch you're working on, so you might miss them. It's like dirty dishes in a shared kitchen: if there are _any_, these will quickly multiply ;-) Is there a way to suppress those errors known (assuming the errors are not due to something I did wrong), so I can get a clean overview of new errors?
Cheers, JohanjsrnThu, 16 Sep 2010 11:46:39 +0200https://ask.sagemath.org/question/7690/does `sage -testall` test #long doctests?https://ask.sagemath.org/question/7601/does-sage-testall-test-long-doctests/Is it equivalent to `make test`, or to `make testlong`? Does it have a parallel option?
I'm attempting to clarify some of the "how to review patches" parts of the developer guide, and in different places I see different commands for doctesting the entire sage library.nilesFri, 20 Aug 2010 14:04:22 +0200https://ask.sagemath.org/question/7601/Finding the problem in a doctest timeouthttps://ask.sagemath.org/question/7592/finding-the-problem-in-a-doctest-timeout/After changing a file and running the doctests, I'm getting:
sage -t "devel/sage-trac/sage/combinat/sf/hall_littlewood.py"
*** *** Error: TIMED OUT! PROCESS KILLED! *** ***
[360.2 s]
----------------------------------------------------------------------
The following tests failed:
sage -t "devel/sage-trac/sage/combinat/sf/hall_littlewood.py" # Time out
Total time for all tests: 360.3 seconds
Is there an easy way to find out which test it was running when the timeout occurred? Or, equivalently, which tests did pass successfully?Jason BandlowThu, 19 Aug 2010 15:11:43 +0200https://ask.sagemath.org/question/7592/