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

Side by Side Diff: testing_support/filesystem_mock.py

Issue 2148683003: Fix relative file: paths in OWNERS with roots other than '/' (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « owners.py ('k') | tests/owners_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import errno 5 import errno
6 import fnmatch 6 import fnmatch
7 import os 7 import os
8 import re 8 import re
9 import StringIO 9 import StringIO
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 def open_for_reading(self, path): 80 def open_for_reading(self, path):
81 return StringIO.StringIO(self.read_binary_file(path)) 81 return StringIO.StringIO(self.read_binary_file(path))
82 82
83 def read_binary_file(self, path): 83 def read_binary_file(self, path):
84 # Intentionally raises KeyError if we don't recognize the path. 84 # Intentionally raises KeyError if we don't recognize the path.
85 if self.files[path] is None: 85 if self.files[path] is None:
86 _RaiseNotFound(path) 86 _RaiseNotFound(path)
87 return self.files[path] 87 return self.files[path]
88 88
89 @staticmethod 89 def relpath(self, path, base):
90 def relpath(path, base):
91 # This implementation is wrong in many ways; assert to check them for now. 90 # This implementation is wrong in many ways; assert to check them for now.
91 if not base.endswith(self.sep):
92 base += self.sep
92 assert path.startswith(base) 93 assert path.startswith(base)
93 assert base.endswith('/')
94 return path[len(base):] 94 return path[len(base):]
OLDNEW
« no previous file with comments | « owners.py ('k') | tests/owners_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698