Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop Sage tests from saving things to hard drive #6864

Closed
kcrisman opened this issue Sep 2, 2009 · 15 comments
Closed

Stop Sage tests from saving things to hard drive #6864

kcrisman opened this issue Sep 2, 2009 · 15 comments

Comments

@kcrisman
Copy link
Member

kcrisman commented Sep 2, 2009

As far as I can tell, there are several objects that are saved when you run sage -t. One example is

    sage: from pylab import *
    sage: t = arange(0.0, 2.0, 0.01)
    sage: s = sin(2*pi*t)
    sage: P = plot(t, s, linewidth=1.0)
    sage: xl = xlabel('time (s)')
    sage: yl = ylabel('voltage (mV)')
    sage: t = title('About as simple as it gets, folks')
    sage: grid(True)
    sage: savefig('sage.png')

in sage/plot/plot.py. However, there are others, which are unfortunately not anywhere near as easy to find, since they don't have a goofy caption.

The point is these should not be cluttering up one's home directory. This one seems to do it right:

sage: text("sage", (0,0), rgbcolor=(0,0,0)).save(SAGE_TMP + 'a.pdf')

which is in the sage/plot/text.py, I think. It does not show up in my home directory.

I'm not sure what else there is for sure, but I get at the very least the graphics which are attached. If you recognize them, post it here. Note also that there is a test.sobj and tmp.sws that get saved.

Component: doctest coverage

Author: John Palmieri

Reviewer: Karl-Dieter Crisman

Merged: Sage 4.1.2.alpha2

Issue created by migration from https:https://user-images.githubusercontent.com/1775728/216875338-9f33d8b5-c454-49d6-9dde-fbb3c64e3ee5.png625d.pngmath.org/ticket/6864

@kcrisman kcrisman added this to the sage-4.1.2 milestone Sep 2, 2009
@kcrisman
Copy link
Member Author

kcrisman commented Sep 2, 2009

Attachment: sage.png

@kcrisman
Copy link
Member Author

kcrisman commented Sep 2, 2009

Attachment: sage0.png

@kcrisman
Copy link
Member Author

kcrisman commented Sep 2, 2009

Attachment: sage2.png

Attachment: 0.png

@kcrisman
Copy link
Member Author

kcrisman commented Sep 2, 2009

comment:1

Attachment: zz.png

@kcrisman

This comment has been minimized.

@jhpalmieri
Copy link
Member

comment:2

This ticket is a good idea. Here are some things I've found:

The file 'zz.png' is from sage.misc.latex, the function png. By the way, in that same file, the function _run_latex_ saves its output to a temporary directory like this:

        sage: from sage.misc.latex import _run_latex_, _latex_file_
        sage: from sage.misc.misc import tmp_dir
        sage: base = tmp_dir()
        sage: file = os.path.join(base, "temp.tex")
        sage: O = open(file, 'w')
        sage: O.write(_latex_file_([ZZ[x], RR])); O.close()
        sage: _run_latex_(file) # random - depends on whether latex is installed
        'dvi'

In the class ode_solver in sage.gsl.ode, a file "sage.png" is produced:

         By default T.plot_solution() plots the y_0, to plot general y_i use
         sage: T.plot_solution(i=0, filename='sage.png')
         sage: T.plot_solution(i=1, filename='sage.png')
         sage: T.plot_solution(i=2, filename='sage.png')

This gets overwritten by the "as simple as it gets" example, though.

_import_worksheet_sws in sage.server.notebook.notebook: produces the file "tmp.sws". (Note that the file is exported and then imported again, so if we change the path name, it needs to be done in both places.)

In sage.structure.sage_object, we get sage.png and test.sobj, both in the function save.

"0.png" seems to come from sage.databases.database, in the function _apply_plot, maybe.

I'll try to track down the others later.

@kcrisman
Copy link
Member Author

kcrisman commented Sep 2, 2009

comment:3

Another one is in calculus/calculus.py, line 1200

(p1+p2).save()

in a long differential equations example. This is the one labeled sage0.png above.

I think that leaves only sage2.png to be found. This is a single point, and it's not clear if it comes from plotting or elsewhere.

Notwithstanding that some optional doctests also save...

@jhpalmieri
Copy link
Member

comment:4

Replying to @kcrisman:

I think that leaves only sage2.png to be found. This is a single point, and it's not clear if it comes from plotting or elsewhere.

It's from visualize_structure in sage.matrix.matrix2.

@jhpalmieri
Copy link
Member

comment:5

Here's a patch. I couldn't figure out how to fix the one in database.py, so it is now "not tested".

@kcrisman
Copy link
Member Author

comment:6

Attachment: trac_6864-SAGETMP.patch.gz

Great! Thanks. This passes all relevant doctests and nothing appears in my home directory. I think not testing that example will be okay.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 16, 2009

Author: John Palmieri

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 16, 2009

comment:7

Merged trac_6864-SAGETMP.patch.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 16, 2009

Reviewer: Karl-Dieter Crisman

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Sep 16, 2009

Merged: Sage 4.1.2.alpha2

@sagetrac-mvngu sagetrac-mvngu mannequin closed this as completed Sep 16, 2009
@jhpalmieri
Copy link
Member

comment:8

See #7059 for a followup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants