Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1178)

Unified Diff: testing_support/filesystem_mock.py

Issue 11114005: implement per-file OWNERS support (Closed) Base URL: https://git.chromium.org/chromium/tools/depot_tools.git@master
Patch Set: update w/ more review feedback Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « presubmit_support.py ('k') | tests/owners_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing_support/filesystem_mock.py
diff --git a/testing_support/filesystem_mock.py b/testing_support/filesystem_mock.py
index 270b2244a0f2ff9aae93be27022d9e070a59eaa9..afcc2e3c79f105c96f24aa37e312f60aa0250637 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[len(base):]
+ return path
« no previous file with comments | « presubmit_support.py ('k') | tests/owners_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698