| OLD | NEW |
| 1 # Copyright (C) 2009 Google Inc. All rights reserved. | 1 # Copyright (C) 2009 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 self.last_tmpdir = None | 54 self.last_tmpdir = None |
| 55 self.current_tmpno = 0 | 55 self.current_tmpno = 0 |
| 56 self.cwd = cwd | 56 self.cwd = cwd |
| 57 self.dirs = set(dirs or []) | 57 self.dirs = set(dirs or []) |
| 58 self.dirs.add(cwd) | 58 self.dirs.add(cwd) |
| 59 for f in self.files: | 59 for f in self.files: |
| 60 d = self.dirname(f) | 60 d = self.dirname(f) |
| 61 while not d in self.dirs: | 61 while not d in self.dirs: |
| 62 self.dirs.add(d) | 62 self.dirs.add(d) |
| 63 d = self.dirname(d) | 63 d = self.dirname(d) |
| 64 |
| 64 def clear_written_files(self): | 65 def clear_written_files(self): |
| 65 # This function can be used to track what is written between steps in a
test. | 66 # This function can be used to track what is written between steps in a
test. |
| 66 self.written_files = {} | 67 self.written_files = {} |
| 67 | 68 |
| 68 def _raise_not_found(self, path): | 69 def _raise_not_found(self, path): |
| 69 raise IOError(errno.ENOENT, path, os.strerror(errno.ENOENT)) | 70 raise IOError(errno.ENOENT, path, os.strerror(errno.ENOENT)) |
| 70 | 71 |
| 71 def _split(self, path): | 72 def _split(self, path): |
| 72 # This is not quite a full implementation of os.path.split | 73 # This is not quite a full implementation of os.path.split |
| 73 # http://docs.python.org/library/os.path.html#os.path.split | 74 # http://docs.python.org/library/os.path.html#os.path.split |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 return self.data.readline(length) | 494 return self.data.readline(length) |
| 494 | 495 |
| 495 def __iter__(self): | 496 def __iter__(self): |
| 496 return self.data.__iter__() | 497 return self.data.__iter__() |
| 497 | 498 |
| 498 def next(self): | 499 def next(self): |
| 499 return self.data.next() | 500 return self.data.next() |
| 500 | 501 |
| 501 def seek(self, offset, whence=os.SEEK_SET): | 502 def seek(self, offset, whence=os.SEEK_SET): |
| 502 self.data.seek(offset, whence) | 503 self.data.seek(offset, whence) |
| OLD | NEW |