summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-03-13 12:41:48 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-03-13 12:41:48 (GMT)
commit1b51c3d4deb4e99fe8440ce9e6f82769e2a1b9be (patch)
tree1803f0b1f84dc7f33d9574d80ccac3bb14445eb8 /Lib/test/test_support.py
parent13ba1a1c6571dad26e3030525556ec4b552b0865 (diff)
downloadcpython-1b51c3d4deb4e99fe8440ce9e6f82769e2a1b9be.zip
cpython-1b51c3d4deb4e99fe8440ce9e6f82769e2a1b9be.tar.gz
cpython-1b51c3d4deb4e99fe8440ce9e6f82769e2a1b9be.tar.bz2
Do not chdir when running test_xml_etree, and enhance the findfile helper.
Diffstat (limited to 'Lib/test/test_support.py')
-rw-r--r--Lib/test/test_support.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index c8aed4e..a8f9fbf7 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -424,12 +424,14 @@ def temp_cwd(name='tempcwd', quiet=False):
rmtree(name)
-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: