Chromium Code Reviews| Index: testing_support/filesystem_mock.py |
| diff --git a/testing_support/filesystem_mock.py b/testing_support/filesystem_mock.py |
| index 270b2244a0f2ff9aae93be27022d9e070a59eaa9..7c3ae57300f5d9c296d87e1dda2b7f0a408e63e2 100644 |
| --- a/testing_support/filesystem_mock.py |
| +++ b/testing_support/filesystem_mock.py |
| @@ -3,6 +3,7 @@ |
| # found in the LICENSE file. |
| import errno |
| +import fnmatch |
| import os |
| import re |
| import StringIO |
| @@ -65,6 +66,9 @@ class MockFileSystem(object): |
| # it works. |
| return re.sub(re.escape(os.path.sep), self.sep, os.path.join(*comps)) |
| + def glob(self, path): |
| + return fnmatch.filter(self.files.keys(), path) |
| + |
| def open_for_reading(self, path): |
| return StringIO.StringIO(self.read_binary_file(path)) |
| @@ -73,3 +77,9 @@ class MockFileSystem(object): |
| if self.files[path] is None: |
| _RaiseNotFound(path) |
| return self.files[path] |
| + |
| + @staticmethod |
| + def relpath(base, path): |
| + if path.startswith(base): |
| + return path.replace(base, '', 1) |
|
M-A Ruel
2012/10/17 20:07:07
Why not path[len(base):] ?
Dirk Pranke
2012/10/17 21:08:36
That is better. Done.
|
| + return path |