summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/common/system/filesystem_mock.py
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-23 17:03:15 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-23 17:03:15 +0200
commita73d1c176f2f3e0458861de8590dc20321a501ae (patch)
treed897fc5974797c3cb300d7f5916f258df765401f /Tools/Scripts/webkitpy/common/system/filesystem_mock.py
parentc311cf639cc1d6570d67b0a80a8ba04dc992a658 (diff)
downloadqtwebkit-a73d1c176f2f3e0458861de8590dc20321a501ae.tar.gz
Imported WebKit commit a5ae8a56a48e44ebfb9b81aaa5488affaffdb175 (http://svn.webkit.org/repository/webkit/trunk@126420)
New snapshot with OS X 10.6 build fix
Diffstat (limited to 'Tools/Scripts/webkitpy/common/system/filesystem_mock.py')
-rw-r--r--Tools/Scripts/webkitpy/common/system/filesystem_mock.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/Tools/Scripts/webkitpy/common/system/filesystem_mock.py b/Tools/Scripts/webkitpy/common/system/filesystem_mock.py
index c2d823a81..d87fe1b8e 100644
--- a/Tools/Scripts/webkitpy/common/system/filesystem_mock.py
+++ b/Tools/Scripts/webkitpy/common/system/filesystem_mock.py
@@ -36,6 +36,9 @@ from webkitpy.common.system import path
class MockFileSystem(object):
+ sep = '/'
+ pardir = '..'
+
def __init__(self, files=None, dirs=None, cwd='/'):
"""Initializes a "mock" filesystem that can be used to completely
stub out a filesystem.
@@ -48,7 +51,6 @@ class MockFileSystem(object):
self.files = files or {}
self.written_files = {}
self.last_tmpdir = None
- self._sep = '/'
self.current_tmpno = 0
self.cwd = cwd
self.dirs = set(dirs or [])
@@ -59,11 +61,6 @@ class MockFileSystem(object):
self.dirs.add(d)
d = self.dirname(d)
- def _get_sep(self):
- return self._sep
-
- sep = property(_get_sep, doc="pathname separator")
-
def clear_written_files(self):
# This function can be used to track what is written between steps in a test.
self.written_files = {}
@@ -343,8 +340,8 @@ class MockFileSystem(object):
path = self.abspath(path)
if not path.lower().startswith(start.lower()):
- # Then path is outside the directory given by start.
- return None # FIXME: os.relpath still returns a path here.
+ # path is outside the directory given by start; compute path from root
+ return '../' * start.count('/') + path
rel_path = path[len(start):]
@@ -359,7 +356,8 @@ class MockFileSystem(object):
else:
# We are in the case typified by the following example:
# path = "/tmp/foobar", start = "/tmp/foo" -> rel_path = "bar"
- return None
+ # FIXME: We return a less-than-optimal result here.
+ return '../' * start.count('/') + path
return rel_path