Index: gm/rebaseline_server/download_test.py |
diff --git a/gm/rebaseline_server/results_test.py b/gm/rebaseline_server/download_test.py |
similarity index 81% |
copy from gm/rebaseline_server/results_test.py |
copy to gm/rebaseline_server/download_test.py |
index 8263f58920afdf3c5d81f984b89b063bed4062a2..51f9c39c2a6169cf25031a353c879d587adf2d7b 100755 |
--- a/gm/rebaseline_server/results_test.py |
+++ b/gm/rebaseline_server/download_test.py |
@@ -1,12 +1,12 @@ |
#!/usr/bin/python |
""" |
-Copyright 2013 Google Inc. |
+Copyright 2014 Google Inc. |
Use of this source code is governed by a BSD-style license that can be |
found in the LICENSE file. |
-Test results.py |
+Test download.py |
epoger
2014/01/22 19:58:10
git decided that this file is a modified version o
|
TODO(epoger): Create a command to update the expected results (in |
OUTPUT_DIR_EXPECTED) when appropriate. For now, you should: |
@@ -18,16 +18,16 @@ within OUTPUT_DIR_EXPECTED, which wouldn't be good... |
""" |
+# System-level imports |
import filecmp |
import os |
import shutil |
-import sys |
import tempfile |
import unittest |
+import url_or_path |
# Imports from within Skia |
-import results |
-import gm_json # must import results first, so that gm_json will be in sys.path |
+import download |
PARENT_DIR = os.path.dirname(os.path.realpath(__file__)) |
INPUT_DIR = os.path.join(PARENT_DIR, 'tests', 'inputs') |
@@ -35,7 +35,7 @@ OUTPUT_DIR_ACTUAL = os.path.join(PARENT_DIR, 'tests', 'outputs', 'actual') |
OUTPUT_DIR_EXPECTED = os.path.join(PARENT_DIR, 'tests', 'outputs', 'expected') |
-class ResultsTest(unittest.TestCase): |
+class DownloadTest(unittest.TestCase): |
def setUp(self): |
self._temp_dir = tempfile.mkdtemp() |
@@ -67,16 +67,21 @@ class ResultsTest(unittest.TestCase): |
"""Tell unittest framework to not print docstrings for test cases.""" |
return None |
- def test_gm(self): |
- """Process results of a GM run with the Results object.""" |
- results_obj = results.Results( |
- actuals_root=os.path.join(INPUT_DIR, 'gm-actuals'), |
- expected_root=os.path.join(INPUT_DIR, 'gm-expectations'), |
- generated_images_root=self._temp_dir) |
- gm_json.WriteToFile(results_obj.get_results_of_type(results.RESULTS_ALL), |
- os.path.join(self._output_dir_actual, 'gm.json')) |
+ def test_fetch(self): |
+ """Tests fetch() of GM results from actual-results.json .""" |
+ downloader = download.Download( |
+ actuals_base_url=os.path.join(INPUT_DIR, 'gm-actuals'), |
+ gm_actuals_root_url=url_or_path.create_filepath_url( |
+ os.path.join(INPUT_DIR, 'fake-gm-imagefiles'))) |
+ downloader.fetch( |
+ builder_name='Test-Android-GalaxyNexus-SGX540-Arm7-Release', |
+ dest_dir=self._output_dir_actual) |
+# TODO(epoger): create_empty_dir(), find_different_files(), etc. should be |
+# extracted from this file to some common location, where they can be shared |
+# with results_test.py and other users. |
+ |
def create_empty_dir(path): |
"""Create an empty directory at the given path.""" |
if os.path.isdir(path): |
@@ -115,7 +120,7 @@ def find_different_files(dir1, dir2, ignore_subtree_names=None): |
def main(): |
- suite = unittest.TestLoader().loadTestsFromTestCase(ResultsTest) |
+ suite = unittest.TestLoader().loadTestsFromTestCase(DownloadTest) |
unittest.TextTestRunner(verbosity=2).run(suite) |