Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#6861 closed enhancement (fixed)

[with patch, positive review] allow users to test Sage script using system-wide Sage installation

Reported by: mvngu Owned by: tbd
Priority: major Milestone: sage-4.1.2
Component: doctest coverage Keywords:
Cc: Merged in: Sage 4.1.2.alpha4
Authors: Jason Grout, Francis Clarke Reviewers: Tim Dumol
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

At least in Sage 4.1.1, a regular user cannot run tests on their own Sage scripts using a system-wide installation of Sage. Doing so would result in a permission error:

[mvngu@mod mvngu]$ cat demo.sage 
print 2
[mvngu@mod mvngu]$ sage -t demo.sage 
Traceback (most recent call last):
  File "/usr/local/sage/local/bin/sage-test", line 49, in <module>
    os.makedirs(TMP)
  File "/usr/local/sage/local/lib/python/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/sage/tmp/tmp'

That is due to the testing script writing temporary data to a temporary directory under the system-wide Sage installation. A work around is to have one's own local installation of Sage under one's home directory. But it would be nice if the test script would write temporary data to the user's DOT_SAGE directory, i.e. $HOME/.sage. This problem was reported at this sage-support thread.

Attachments (4)

trac_6861-sage-test-in-dotsage.patch (745 bytes) - added by jason 10 years ago.
trac_6861-sage-test-in-dotsage.2.patch (745 bytes) - added by jason 10 years ago.
trac_6861_new.patch (6.1 KB) - added by fwclarke 10 years ago.
replaces earlier patches
trac_6861_extra.patch (1.7 KB) - added by fwclarke 10 years ago.
apply after trac_6861_new.patch

Download all attachments as: .zip

Change History (16)

Changed 10 years ago by jason

Changed 10 years ago by jason

comment:1 follow-up: Changed 10 years ago by jason

  • Authors set to Jason Grout
  • Summary changed from allow users to test Sage script using system-wide Sage installation to [with patch , needs review] allow users to test Sage script using system-wide Sage installation

The two files above are identical. One can be deleted.

comment:2 in reply to: ↑ 1 ; follow-up: Changed 10 years ago by fwclarke

Replying to jason:

In addition to the change made by the patch, some corresponding changes need making in sage-test and sage-doctest. Moreover, testing of one's own Sage scripts won't work until the changes in #6668 are also implemented (most particularly the change to line 408 of sage-doctest).

comment:3 in reply to: ↑ 2 ; follow-up: Changed 10 years ago by jason

Replying to fwclarke:

Replying to jason:

In addition to the change made by the patch, some corresponding changes need making in sage-test and sage-doctest. Moreover, testing of one's own Sage scripts won't work until the changes in #6668 are also implemented (most particularly the change to line 408 of sage-doctest).

You sound like you know what needs to be done. Please, please post a patch.

comment:4 in reply to: ↑ 3 ; follow-up: Changed 10 years ago by fwclarke

Replying to jason:

You sound like you know what needs to be done. Please, please post a patch.

Will do, but not immediately; there are a few things I don't quite understand, and I'm off to the day-job now.

comment:5 in reply to: ↑ 4 Changed 10 years ago by fwclarke

Replying to fwclarke:

There are a few things I don't quite understand ...

It seems to me that if (because of the changed definition of SAGE_TESTDIR) the directory ~/.sage/tmp is to be used for testing system files, then logically it should also be used for testing users' own files. This requires a few more changes.

It also seems worthwhile to active the function delete_tmpfiles in sage-doctest; at present this function does nothing. The obvious things is for it to get called if the doctest succeeds without any failures, but at present the method of counting the number of failures is defective.

I have implemented these ideas and am testing the code. A patch will follow soon.

comment:6 Changed 10 years ago by fwclarke

The new patch, which incorporates the change in the earlier patch, also includes the changes made in the patch at #6668.

Changed 10 years ago by fwclarke

replaces earlier patches

comment:7 Changed 10 years ago by fwclarke

  • Summary changed from [with patch , needs review] allow users to test Sage script using system-wide Sage installation to [with patches , needs review] allow users to test Sage script using system-wide Sage installation

I have added an extra patch (to be applied after trac_6861_new.patch) which deals with a problem in testing files specified by their full path name, as discussed in sage-devel.

Changed 10 years ago by fwclarke

apply after trac_6861_new.patch

comment:8 Changed 10 years ago by timdumol

  • Authors changed from Jason Grout to Jason Grout, Francis Clarke
  • Reviewers set to Tim Dumol
  • Summary changed from [with patches , needs review] allow users to test Sage script using system-wide Sage installation to [with patches , positive review] allow users to test Sage script using system-wide Sage installation

Patches work perfectly, and I've run several dozen doctests without any problems. Temporary files are deleted as promised. Nice job guys. Positive review.

comment:9 Changed 10 years ago by mvngu

  • Merged in set to Sage 4.1.2.alpha3
  • Resolution set to fixed
  • Status changed from new to closed
  • Summary changed from [with patches , positive review] allow users to test Sage script using system-wide Sage installation to [with patches, positive review] allow users to test Sage script using system-wide Sage installation

Merged in the script repository.

comment:10 Changed 10 years ago by mvngu

  • Summary changed from [with patches, positive review] allow users to test Sage script using system-wide Sage installation to [with patch, positive review] allow users to test Sage script using system-wide Sage installation

comment:11 Changed 10 years ago by mvngu

  • Merged in changed from Sage 4.1.2.alpha3 to Sage 4.1.2.alpha4

There is no 4.1.2.alpha3. Sage 4.1.2.alpha3 was William Stein's release for working on making the notebook a standalone package.

comment:12 Changed 10 years ago by mvngu

See #7079 for a case where the current ticket breaks parallel doctesting.

Note: See TracTickets for help on using tickets.