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

Side by Side Diff: testing_support/filesystem_mock.py

Issue 1085993004: Implement support for file: includes in OWNERS files. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: minor cleanups Created 5 years, 8 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 20 matching lines...) Expand all
31 return self._sep 31 return self._sep
32 32
33 def _split(self, path): 33 def _split(self, path):
34 return path.rsplit(self.sep, 1) 34 return path.rsplit(self.sep, 1)
35 35
36 def abspath(self, path): 36 def abspath(self, path):
37 if path.endswith(self.sep): 37 if path.endswith(self.sep):
38 return path[:-1] 38 return path[:-1]
39 return path 39 return path
40 40
41 def basename(self, path):
42 if self.sep not in path:
43 return ''
44 return self._split(path)[-1] or self.sep
45
41 def dirname(self, path): 46 def dirname(self, path):
42 if self.sep not in path: 47 if self.sep not in path:
43 return '' 48 return ''
44 return self._split(path)[0] or self.sep 49 return self._split(path)[0] or self.sep
45 50
46 def exists(self, path): 51 def exists(self, path):
47 return self.isfile(path) or self.isdir(path) 52 return self.isfile(path) or self.isdir(path)
48 53
49 def isabs(self, path): 54 def isabs(self, path):
50 return path.startswith(self.sep) 55 return path.startswith(self.sep)
(...skipping 29 matching lines...) Expand all
80 if self.files[path] is None: 85 if self.files[path] is None:
81 _RaiseNotFound(path) 86 _RaiseNotFound(path)
82 return self.files[path] 87 return self.files[path]
83 88
84 @staticmethod 89 @staticmethod
85 def relpath(path, base): 90 def relpath(path, base):
86 # This implementation is wrong in many ways; assert to check them for now. 91 # This implementation is wrong in many ways; assert to check them for now.
87 assert path.startswith(base) 92 assert path.startswith(base)
88 assert base.endswith('/') 93 assert base.endswith('/')
89 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