| 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 """Tests for module file_utils.""" | 6 """Tests for module file_utils.""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import unittest | 10 import unittest |
| 11 | 11 |
| 12 import misc | 12 BUILDBOT_PATH = os.path.realpath(os.path.join( |
| 13 os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, os.pardir) |
| 14 ) |
| 15 |
| 13 # Appending to PYTHONPATH to find common. | 16 # Appending to PYTHONPATH to find common. |
| 14 sys.path.append(os.path.join(misc.BUILDBOT_PATH, 'third_party', | 17 sys.path.append(os.path.join(BUILDBOT_PATH, 'third_party', 'chromium_buildbot', |
| 15 'chromium_buildbot', 'scripts')) | 18 'scripts')) |
| 16 import file_utils | 19 import file_utils |
| 17 | 20 |
| 18 from common import chromium_utils | 21 from common import chromium_utils |
| 19 | 22 |
| 20 | 23 |
| 21 class TestFileUtils(unittest.TestCase): | 24 class TestFileUtils(unittest.TestCase): |
| 22 | 25 |
| 23 def setUp(self): | 26 def setUp(self): |
| 24 self._path_exists_ret = True | 27 self._path_exists_ret = True |
| 25 self._path_exists_called = False | 28 self._path_exists_called = False |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 def test_create_clean_local_dir_PathDoesNotExists(self): | 62 def test_create_clean_local_dir_PathDoesNotExists(self): |
| 60 self._path_exists_ret = False | 63 self._path_exists_ret = False |
| 61 file_utils.create_clean_local_dir('/tmp/test') | 64 file_utils.create_clean_local_dir('/tmp/test') |
| 62 self.assertTrue(self._path_exists_called) | 65 self.assertTrue(self._path_exists_called) |
| 63 self.assertTrue(self._make_dirs_called) | 66 self.assertTrue(self._make_dirs_called) |
| 64 self.assertFalse(self._remove_dir_called) | 67 self.assertFalse(self._remove_dir_called) |
| 65 | 68 |
| 66 | 69 |
| 67 if __name__ == '__main__': | 70 if __name__ == '__main__': |
| 68 unittest.main() | 71 unittest.main() |
| OLD | NEW |