[Python-checkins] r82858 - python/branches/release31-maint/Lib/test/support.py

victor.stinner python-checkins at python.org
Wed Jul 14 01:14:47 CEST 2010


Author: victor.stinner
Date: Wed Jul 14 01:14:46 2010
New Revision: 82858

Log:
Partial port of r78919 from trunk: add subdir argument to the findfile helper


Modified:
   python/branches/release31-maint/Lib/test/support.py

Modified: python/branches/release31-maint/Lib/test/support.py
==============================================================================
--- python/branches/release31-maint/Lib/test/support.py	(original)
+++ python/branches/release31-maint/Lib/test/support.py	Wed Jul 14 01:14:46 2010
@@ -387,12 +387,14 @@
     unlink(TESTFN)
 del fp
 
-def findfile(file, here=__file__):
+def findfile(file, here=__file__, subdir=None):
     """Try to find a file on sys.path and the working directory.  If it is not
     found the argument passed to the function is returned (this does not
     necessarily signal failure; could still be the legitimate path)."""
     if os.path.isabs(file):
         return file
+    if subdir is not None:
+        file = os.path.join(subdir, file)
     path = sys.path
     path = [os.path.dirname(here)] + path
     for dn in path:


More information about the Python-checkins mailing list