Ticket #9739: trac_9739-delta1to2.patch

File trac_9739-delta1to2.patch, 3.3 KB (added by jhpalmieri, 9 years ago)

for review only

  • sage-doctest

    diff --git a/sage-doctest b/sage-doctest
    a b if 'SAGE_TESTDIR' not in os.environ or o 
    7777else:
    7878    SAGE_TESTDIR = os.environ['SAGE_TESTDIR']
    7979
    80 def filename_mangler(name):
    81     """
    82     Replace ``name`` with 'doctest_PID_CWD-name.py', where PID is the
    83     process ID and CWD is the current working directory, which should
    84     be the directory containing ``name``, but with all slashes
    85     replaced by periods (to avoid name clashes between files from
    86     different directories with the same name).
    87     """
    88     new = os.path.join(os.getcwd(), name).replace(os.path.sep, '.')
    89     new = new.lstrip('.') # remove leading '.'
    90     return os.path.join(SAGE_TESTDIR,
    91                         "doctest_%s_%s" % (os.getpid(), new))
    92 
    9380tmpfiles = [] # list of temporary files to be deleted if doctesting succeeds
    9481
    9582def delete_tmpfiles():
    def test_file(file, library_code): 
    657644
    658645        name = os.path.basename(file)
    659646        name = name[:name.find(".")]
    660         f = os.path.splitext(filename_mangler(file))[0] + '.py'
     647        f = os.path.join(SAGE_TESTDIR, "%s_%s.py" % (name, os.getpid()))
    661648
    662649        open(f,"w").write(s)
    663650        tmpfiles.append(f)
  • sage-ptest

    diff --git a/sage-ptest b/sage-ptest
    a b for gr in range(0,numglobaliteration): 
    295295
    296296        infiles.append(os.path.join(sagenb_loc, 'sagenb'))
    297297
     298    verbose = '-verbose' in opts
     299
    298300    if numthreads == 0:
    299301        # Set numthreads to be the number of processors, with a default
    300302        # maximum of 8.
    for gr in range(0,numglobaliteration): 
    375377    # Add rwx permissions for user to TMP:
    376378    os.chmod(TMP, os.stat(TMP)[0] | stat.S_IRWXU)
    377379    os.environ['SAGE_TESTDIR'] = TMP
    378     print
    379     print "Using the directory"
    380     print "   '%s'." % TMP
    381     print "for doctesting.  If all doctests pass, this directory will"
    382     print "be deleted automatically."
    383     print
     380    if verbose:
     381        print
     382        print "Using the directory"
     383        print "   '%s'." % TMP
     384        print "for doctesting.  If all doctests pass, this directory will"
     385        print "be deleted automatically."
     386        print
    384387
    385388    populatefilelist(infiles)
    386389    #Sort the files by test time
    for gr in range(0,numglobaliteration): 
    414417    print "-"*int(70)
    415418
    416419    os.chdir(CUR)
    417    
    418     print
    419     print "Removing the directory '%s'." % TMP
     420
     421    if verbose:
     422        print
     423        print "Removing the directory '%s'." % TMP
    420424    try:
    421425        os.rmdir(TMP)
     426        if verbose:
     427            print
     428            print "-"*int(70)
    422429    except OSError:
    423430        # TODO (probably in sage-doctest): if tests were interrupted
    424431        # but there were no failures in the interrupted files, delete
    425432        # the temporary files, so that this directory is empty.
    426         print "Warning: the directory was not removed: it is not empty,"
    427         print "probably because doctesting failed or was interrupted."
     433        print "Warning: the temporary doctesting directory"
     434        print "   %s" % TMP
     435        print "was not removed: it is not empty, probably because doctesting"
     436        print "failed or was interrupted."
     437        print
     438        print "-"*int(70)
    428439
    429     print
    430     print "-"*int(70)
    431440    if len(failed) == 0:
    432441        if interrupt == False:
    433442            print "All tests passed!"