Ticket #9739: trac_9739-extra.patch

File trac_9739-extra.patch, 1.4 KB (added by jhpalmieri, 9 years ago)

scripts repo; apply on top of other patch

  • sage-doctest

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1313447303 25200
    # Node ID f5a8c6d204e969b861cb5839ece6050671087b0c
    # Parent  9ba7162d80e9be5880c493e1fed479db17862e3f
    #9739: fix problems with doctesting non-library python files.
    
    diff --git a/sage-doctest b/sage-doctest
    a b def check_with_tolerance(expected, actua 
    510510
    511511        elif ext in ['.py', '.sage']:
    512512
    513             target_name = "%s_%d" % (file_name, os.getpid()) # like 'name', but unique
    514             target_base = os.path.join(SAGE_TESTDIR, target_name) # like 'base', also unique
     513            root_name = os.path.basename(root_name)
     514            target_name = "%s_%d" % (root_name, os.getpid()) # like 'root_name', but unique
     515            target_base = os.path.join(SAGE_TESTDIR, target_name) # like 'target_name' but with full path
    515516
    516517            if ext == '.sage':
    517518                # TODO: preparse "<file>.sage" with a Sage library call
    def check_with_tolerance(expected, actua 
    528529                # TODO: instead of copying the file, add its source
    529530                # directory to PYTHONPATH.  We would also have to
    530531                # import from 'name' instead of 'target_name'.
    531                 os.system("cp '%s' %s.py" % (source, target_base))
     532                os.system("cp '%s' %s.py" % (file_name, target_base))
    532533
    533534            s += "from %s import *\n\n" % target_name
    534535