Ticket #8817 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Rplot001.png left around when doctesting

Reported by: was Owned by: tbd
Priority: blocker Milestone: sage-4.4.1
Component: doctest coverage Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers: Minh Van Nguyen
Authors: Karl-Dieter Crisman, William Stein Merged in: sage-4.4.1.alpha3
Dependencies: Stopgaps:

Description

I doctested after I think #7665 and this file Rplot001.png appeared in SAGE_ROOT. That's obnoxious.

Attachments

trac_8817-R-plot-file-remove.patch Download (3.2 KB) - added by kcrisman 3 years ago.
Based on Sage 4.4 + R plot patch
trac_8817-wstein.patch Download (710 bytes) - added by was 3 years ago.

Change History

comment:1 Changed 3 years ago by kcrisman

eah, this is my fault:

+        This example saves a plot to the standard R output, usually 
+        a filename like ``Rplot001.png`` - from the command line, in 
+        the current directory, and in the cell directory in the notebook::
+
+            sage: r.plot("1:10")
+            null device 
+                      1 
+

I actually put this one in to show users how to actually get a file in a directory that they have access to, as opposed to a temp directory, but forgot we can't do that. Is it legitimate to put #not tested with this doctest as a fix, since it is important to have the example there?

comment:2 Changed 3 years ago by kcrisman

  • Status changed from new to needs_review
  • Authors set to Karl-Dieter Crisman

comment:3 Changed 3 years ago by kcrisman

  • Status changed from needs_review to needs_work

but forgot we can't do that. Is it legitimate to put #not tested with this doctest as a fix, since it is important to have the example there?

From was:

Another option:

1. make sufpre the png file you are about to write doesn't exist in the current directory, then write it.
2. then delete it!


# not tested should be avoided at all costs.

Changed 3 years ago by kcrisman

Based on Sage 4.4 + R plot patch

comment:4 Changed 3 years ago by kcrisman

  • Status changed from needs_work to needs_review

Okay, try this - it is VERY explicit. I also replaced occurrences of os.unlink with os.remove, which is identical but makes far more sense to those who are not familiar with the unlink command (like me).

comment:5 Changed 3 years ago by was

I really don't like this very brittle and dangerous patch. I've posted a new patch. Please review. I've included this in alpha3 anyways.

William

Changed 3 years ago by was

comment:6 Changed 3 years ago by mvngu

  • Status changed from needs_review to closed
  • Authors changed from Karl-Dieter Crisman to Karl-Dieter Crisman, William Stein
  • Milestone changed from sage-4.4.2 to sage-4.4.1
  • Reviewers set to Minh Van Nguyen
  • Resolution set to fixed
  • Merged in set to sage-4.4.1.alpha3

The directory named by the environment variable SAGE_TMP is where junk files can go. Such junk files include temporary files generated during doctesting.

Note: See TracTickets for help on using tickets.