| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 """ | 3 """ |
| 4 Copyright 2013 Google Inc. | 4 Copyright 2013 Google Inc. |
| 5 | 5 |
| 6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
| 7 found in the LICENSE file. | 7 found in the LICENSE file. |
| 8 | 8 |
| 9 Test results.py | 9 Test results.py |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 def test_gm(self): | 70 def test_gm(self): |
| 71 """Process results of a GM run with the Results object.""" | 71 """Process results of a GM run with the Results object.""" |
| 72 results_obj = results.Results( | 72 results_obj = results.Results( |
| 73 actuals_root=os.path.join(INPUT_DIR, 'gm-actuals'), | 73 actuals_root=os.path.join(INPUT_DIR, 'gm-actuals'), |
| 74 expected_root=os.path.join(INPUT_DIR, 'gm-expectations'), | 74 expected_root=os.path.join(INPUT_DIR, 'gm-expectations'), |
| 75 generated_images_root=self._temp_dir) | 75 generated_images_root=self._temp_dir) |
| 76 gm_json.WriteToFile(results_obj.get_results_of_type(results.RESULTS_ALL), | 76 gm_json.WriteToFile(results_obj.get_results_of_type(results.RESULTS_ALL), |
| 77 os.path.join(self._output_dir_actual, 'gm.json')) | 77 os.path.join(self._output_dir_actual, 'gm.json')) |
| 78 | 78 |
| 79 | 79 |
| 80 # TODO(epoger): create_empty_dir(), find_different_files(), etc. should be |
| 81 # extracted from this file to some common location, where they can be shared |
| 82 # with download_test.py and other users. |
| 83 |
| 80 def create_empty_dir(path): | 84 def create_empty_dir(path): |
| 81 """Create an empty directory at the given path.""" | 85 """Create an empty directory at the given path.""" |
| 82 if os.path.isdir(path): | 86 if os.path.isdir(path): |
| 83 shutil.rmtree(path) | 87 shutil.rmtree(path) |
| 84 elif os.path.lexists(path): | 88 elif os.path.lexists(path): |
| 85 os.remove(path) | 89 os.remove(path) |
| 86 os.makedirs(path) | 90 os.makedirs(path) |
| 87 | 91 |
| 88 | 92 |
| 89 def find_different_files(dir1, dir2, ignore_subtree_names=None): | 93 def find_different_files(dir1, dir2, ignore_subtree_names=None): |
| (...skipping 24 matching lines...) Expand all Loading... |
| 114 return differing_files | 118 return differing_files |
| 115 | 119 |
| 116 | 120 |
| 117 def main(): | 121 def main(): |
| 118 suite = unittest.TestLoader().loadTestsFromTestCase(ResultsTest) | 122 suite = unittest.TestLoader().loadTestsFromTestCase(ResultsTest) |
| 119 unittest.TextTestRunner(verbosity=2).run(suite) | 123 unittest.TextTestRunner(verbosity=2).run(suite) |
| 120 | 124 |
| 121 | 125 |
| 122 if __name__ == '__main__': | 126 if __name__ == '__main__': |
| 123 main() | 127 main() |
| OLD | NEW |