diff --git a/Lib/test/support.py b/Lib/test/support/__init__.py rename from Lib/test/support.py rename to Lib/test/support/__init__.py --- a/Lib/test/support.py +++ b/Lib/test/support/__init__.py @@ -789,8 +789,9 @@ finally: os.umask(oldmask) +TEST_HOME = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -def findfile(file, here=__file__, subdir=None): +def findfile(file, here=TEST_HOME, 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).""" @@ -799,7 +800,7 @@ if subdir is not None: file = os.path.join(subdir, file) path = sys.path - path = [os.path.dirname(here)] + path + path = [here] + path for dn in path: fn = os.path.join(dn, file) if os.path.exists(fn): return fn diff --git a/Lib/test/test_linecache.py b/Lib/test/test_linecache.py --- a/Lib/test/test_linecache.py +++ b/Lib/test/test_linecache.py @@ -11,7 +11,7 @@ EMPTY = '' TESTS = 'inspect_fodder inspect_fodder2 mapping_tests' TESTS = TESTS.split() -TEST_PATH = os.path.dirname(support.__file__) +TEST_PATH = os.path.dirname(__file__) MODULES = "linecache abc".split() MODULE_PATH = os.path.dirname(FILENAME)