#9739: Handle duplicate file basenames when testing multiple files in parallel
-----------------------------------------------+----------------------------
Reporter: mpatel | Owner: mvngu
Type: defect | Status: needs_review
Priority: blocker | Milestone: sage-4.7.2
Component: doctest | Keywords: doctest
scripts
Work_issues: | Upstream: N/A
Reviewer: Robert Bradshaw, Leif Leonhardy | Author: Mitesh Patel,
John Palmieri
Merged: | Dependencies:
-----------------------------------------------+----------------------------
Comment(by jhpalmieri):
> Shouldn't doctests delete the files they create afterwards anyway?
Examples in Sage code can create files anywhere in the filesystem, but
they ''should'' only create temporary files or delete files after they're
finished with them. The directory SAGE_TMP gets cleaned up automatically,
so it's a good choice, as opposed to SAGE_TESTDIR.
Replying to [comment:77 leif]:
> Some minor things:
>
> * `"%s" % os.getpid()` works, but in principle it should use `"%d"`.
Okay. We seem to have used "%d" elsewhere in the file, not sure why I
didn't this time.
> * I think we should also (already) support the proper long option
format, `--verbose`, there.
Oh, right, I misunderstood `opts`: I thought it was just the string of
options instead of a list.
> * I would omit the "''Warning:''" in case (we know that) doctest errors
occurred, since it is the desired behaviour to keep at least the failing
files in that case. [[BR]]
Okay.
> We ''could'' also list the contents of the directory there ("''The
following files have been kept [because of doctest errors]: ...''"). (In
principle we also would have to relate them back to their original files,
to remove the ambiguity this ticket is all about.)
Looks like an enhancement for another ticket.
I don't think it's worth making a "v3" patch out of this. Here's the
difference between the previous v2 patch and this one:
{{{
#!diff
diff --git a/sage-doctest b/sage-doctest
--- a/sage-doctest
+++ b/sage-doctest
@@ -644,7 +644,7 @@ def test_file(file, library_code):
name = os.path.basename(file)
name = name[:name.find(".")]
- f = os.path.join(SAGE_TESTDIR, "%s_%s.py" % (name, os.getpid()))
+ f = os.path.join(SAGE_TESTDIR, "%s_%d.py" % (name, os.getpid()))
open(f,"w").write(s)
tmpfiles.append(f)
diff --git a/sage-ptest b/sage-ptest
--- a/sage-ptest
+++ b/sage-ptest
@@ -295,7 +295,7 @@ for gr in range(0,numglobaliteration):
infiles.append(os.path.join(sagenb_loc, 'sagenb'))
- verbose = '-verbose' in opts
+ verbose = ('-verbose' in opts or '--verbose' in opts)
if numthreads == 0:
# Set numthreads to be the number of processors, with a default
@@ -430,7 +430,7 @@ for gr in range(0,numglobaliteration):
# TODO (probably in sage-doctest): if tests were interrupted
# but there were no failures in the interrupted files, delete
# the temporary files, so that this directory is empty.
- print "Warning: the temporary doctesting directory"
+ print "The temporary doctesting directory"
print " %s" % TMP
print "was not removed: it is not empty, probably because
doctesting"
print "failed or was interrupted."
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9739#comment:78>
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.