OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """ | 3 """ |
4 Copyright 2014 Google Inc. | 4 Copyright 2014 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 download.py | 9 Test download.py |
10 | 10 |
11 TODO(epoger): Create a command to update the expected results (in | 11 TODO(epoger): Create a command to update the expected results (in |
12 self._output_dir_expected) when appropriate. For now, you should: | 12 self._output_dir_expected) when appropriate. For now, you should: |
13 1. examine the results in self._output_dir_actual and make sure they are ok | 13 1. examine the results in self.output_dir_actual and make sure they are ok |
14 2. rm -rf self._output_dir_expected | 14 2. rm -rf self._output_dir_expected |
15 3. mv self._output_dir_actual self._output_dir_expected | 15 3. mv self.output_dir_actual self._output_dir_expected |
16 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 |
17 within self._output_dir_expected, which wouldn't be good... | 17 within self._output_dir_expected, which wouldn't be good... |
18 | 18 |
19 """ | 19 """ |
20 | 20 |
21 # System-level imports | 21 # System-level imports |
22 import os | 22 import os |
23 | 23 |
24 # Must fix up PYTHONPATH before importing from within Skia | 24 # Must fix up PYTHONPATH before importing from within Skia |
25 import fix_pythonpath # pylint: disable=W0611 | 25 import fix_pythonpath # pylint: disable=W0611 |
26 | 26 |
27 # Imports from within Skia | 27 # Imports from within Skia |
28 from py.utils import url_utils | 28 from py.utils import url_utils |
29 import base_unittest | 29 import base_unittest |
30 import download_actuals | 30 import download_actuals |
31 | 31 |
32 | 32 |
33 class DownloadTest(base_unittest.TestCase): | 33 class DownloadTest(base_unittest.TestCase): |
34 | 34 |
35 def test_fetch(self): | 35 def test_fetch(self): |
36 """Tests fetch() of GM results from actual-results.json .""" | 36 """Tests fetch() of GM results from actual-results.json .""" |
37 downloader = download_actuals.Download( | 37 downloader = download_actuals.Download( |
38 actuals_base_url=url_utils.create_filepath_url( | 38 actuals_base_url=url_utils.create_filepath_url( |
39 os.path.join(self._input_dir, 'gm-actuals')), | 39 os.path.join(self.input_dir, 'gm-actuals')), |
40 gm_actuals_root_url=url_utils.create_filepath_url( | 40 gm_actuals_root_url=url_utils.create_filepath_url( |
41 os.path.join(self._input_dir, 'fake-gm-imagefiles'))) | 41 os.path.join(self.input_dir, 'fake-gm-imagefiles'))) |
42 downloader.fetch( | 42 downloader.fetch( |
43 builder_name='Test-Android-GalaxyNexus-SGX540-Arm7-Release', | 43 builder_name='Test-Android-GalaxyNexus-SGX540-Arm7-Release', |
44 dest_dir=self._output_dir_actual) | 44 dest_dir=self.output_dir_actual) |
45 | 45 |
46 | 46 |
47 def main(): | 47 def main(): |
48 base_unittest.main(DownloadTest) | 48 base_unittest.main(DownloadTest) |
49 | 49 |
50 | 50 |
51 if __name__ == '__main__': | 51 if __name__ == '__main__': |
52 main() | 52 main() |
OLD | NEW |