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 |
11 TODO(epoger): Launch this (and other unittests within this dir) automatically | |
12 on the housekeeper bot, but first make sure it works properly after having been | |
13 checked out (from both git and svn) | |
14 | |
15 TODO(epoger): Create a command to update the expected results (in | 11 TODO(epoger): Create a command to update the expected results (in |
16 OUTPUT_DIR_EXPECTED) when appropriate. For now, you should: | 12 OUTPUT_DIR_EXPECTED) when appropriate. For now, you should: |
17 1. examine the results in OUTPUT_DIR_ACTUAL and make sure they are ok | 13 1. examine the results in OUTPUT_DIR_ACTUAL and make sure they are ok |
18 2. rm -rf OUTPUT_DIR_EXPECTED | 14 2. rm -rf OUTPUT_DIR_EXPECTED |
19 3. mv OUTPUT_DIR_ACTUAL OUTPUT_DIR_EXPECTED | 15 3. mv OUTPUT_DIR_ACTUAL OUTPUT_DIR_EXPECTED |
20 Although, if you're using an SVN checkout, this will blow away .svn directories | 16 Although, if you're using an SVN checkout, this will blow away .svn directories |
21 within OUTPUT_DIR_EXPECTED, which wouldn't be good... | 17 within OUTPUT_DIR_EXPECTED, which wouldn't be good... |
22 | 18 |
23 """ | 19 """ |
24 | 20 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 # | 56 # |
61 # I have confirmed that the test really does fail if this assert is | 57 # I have confirmed that the test really does fail if this assert is |
62 # triggered. | 58 # triggered. |
63 # | 59 # |
64 # Ravi notes: if somebody later comes along and adds cleanup code below the | 60 # Ravi notes: if somebody later comes along and adds cleanup code below the |
65 # assert, then if tests fail, the artifacts will not be cleaned up. | 61 # assert, then if tests fail, the artifacts will not be cleaned up. |
66 assert (not different_files), \ | 62 assert (not different_files), \ |
67 ('found differing files between actual dir %s and expected dir %s: %s' % | 63 ('found differing files between actual dir %s and expected dir %s: %s' % |
68 (self._output_dir_actual, self._output_dir_expected, different_files)) | 64 (self._output_dir_actual, self._output_dir_expected, different_files)) |
69 | 65 |
| 66 def shortDescription(self): |
| 67 """Tell unittest framework to not print docstrings for test cases.""" |
| 68 return None |
| 69 |
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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return differing_files | 114 return differing_files |
115 | 115 |
116 | 116 |
117 def main(): | 117 def main(): |
118 suite = unittest.TestLoader().loadTestsFromTestCase(ResultsTest) | 118 suite = unittest.TestLoader().loadTestsFromTestCase(ResultsTest) |
119 unittest.TextTestRunner(verbosity=2).run(suite) | 119 unittest.TextTestRunner(verbosity=2).run(suite) |
120 | 120 |
121 | 121 |
122 if __name__ == '__main__': | 122 if __name__ == '__main__': |
123 main() | 123 main() |
OLD | NEW |