| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import hashlib | 6 import hashlib |
| 7 import json | 7 import json |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import shutil | 10 import shutil |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 def test_fail_empty_isolated(self): | 181 def test_fail_empty_isolated(self): |
| 182 result_hash = self._store_result({}) | 182 result_hash = self._store_result({}) |
| 183 expected = [ | 183 expected = [ |
| 184 'state.json', | 184 'state.json', |
| 185 result_hash, | 185 result_hash, |
| 186 ] | 186 ] |
| 187 out, err, returncode = self._run(self._generate_args_with_hash(result_hash)) | 187 out, err, returncode = self._run(self._generate_args_with_hash(result_hash)) |
| 188 if not VERBOSE: | 188 if not VERBOSE: |
| 189 self.assertEqual('', out) | 189 self.assertEqual('', out) |
| 190 self.assertEqual('No command to run\n', err) | 190 self.assertIn('No command to run\n', err) |
| 191 self.assertEqual(1, returncode) | 191 self.assertEqual(1, returncode) |
| 192 actual = list_files_tree(self.cache) | 192 actual = list_files_tree(self.cache) |
| 193 self.assertEqual(sorted(expected), actual) | 193 self.assertEqual(sorted(expected), actual) |
| 194 | 194 |
| 195 def test_includes(self): | 195 def test_includes(self): |
| 196 # Loads an .isolated that includes another one. | 196 # Loads an .isolated that includes another one. |
| 197 | 197 |
| 198 # References manifest2.isolated and repeated_files.isolated. Maps file3.txt | 198 # References manifest2.isolated and repeated_files.isolated. Maps file3.txt |
| 199 # as file2.txt. | 199 # as file2.txt. |
| 200 result_hash = self._store('check_files.isolated') | 200 result_hash = self._store('check_files.isolated') |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 self.assertEqual(0, returncode) | 269 self.assertEqual(0, returncode) |
| 270 | 270 |
| 271 self.assertEqual(os.stat(os.path.join(self.data_dir, 'file1.txt')).st_size, | 271 self.assertEqual(os.stat(os.path.join(self.data_dir, 'file1.txt')).st_size, |
| 272 os.stat(cached_file_path).st_size) | 272 os.stat(cached_file_path).st_size) |
| 273 | 273 |
| 274 | 274 |
| 275 if __name__ == '__main__': | 275 if __name__ == '__main__': |
| 276 VERBOSE = '-v' in sys.argv | 276 VERBOSE = '-v' in sys.argv |
| 277 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) | 277 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) |
| 278 unittest.main() | 278 unittest.main() |
| OLD | NEW |