Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: gm/rebaseline_server/download_actuals_test.py

Issue 313343003: reland "rebaseline_server: download actual-results.json files from GCS instead of SVN" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: import apiclient from system-installed Python libraries, not DEPS Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/rebaseline_server/download_actuals.py ('k') | gm/rebaseline_server/fix_pythonpath.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/rebaseline_server/download_actuals_test.py
diff --git a/gm/rebaseline_server/download_actuals_test.py b/gm/rebaseline_server/download_actuals_test.py
index 88135305192dc9ec297e93577c274115e5b657c0..c405a3cf57a6c364503f91e04c8a1079123fc48f 100755
--- a/gm/rebaseline_server/download_actuals_test.py
+++ b/gm/rebaseline_server/download_actuals_test.py
@@ -25,6 +25,8 @@ import tempfile
import urllib
# Imports from within Skia
+import fix_pythonpath # must do this first
+from pyutils import url_utils
import base_unittest
import download_actuals
@@ -34,52 +36,14 @@ class DownloadTest(base_unittest.TestCase):
def test_fetch(self):
"""Tests fetch() of GM results from actual-results.json ."""
downloader = download_actuals.Download(
- actuals_base_url=download_actuals.create_filepath_url(
+ actuals_base_url=url_utils.create_filepath_url(
os.path.join(self._input_dir, 'gm-actuals')),
- gm_actuals_root_url=download_actuals.create_filepath_url(
+ gm_actuals_root_url=url_utils.create_filepath_url(
os.path.join(self._input_dir, 'fake-gm-imagefiles')))
downloader.fetch(
builder_name='Test-Android-GalaxyNexus-SGX540-Arm7-Release',
dest_dir=self._output_dir_actual)
- def test_create_filepath_url(self):
- """Tests create_filepath_url(). """
- with self.assertRaises(Exception):
- url_or_path.create_filepath_url('http://1.2.3.4/path')
- # Pass absolute filepath.
- self.assertEquals(
- download_actuals.create_filepath_url(
- '%sdir%sfile' % (os.path.sep, os.path.sep)),
- 'file:///dir/file')
- # Pass relative filepath.
- self.assertEquals(
- download_actuals.create_filepath_url(os.path.join('dir', 'file')),
- 'file://%s/dir/file' % urllib.pathname2url(os.getcwd()))
-
- def test_copy_contents(self):
- """Tests copy_contents(). """
- contents = 'these are the contents'
- tempdir_path = tempfile.mkdtemp()
- try:
- source_path = os.path.join(tempdir_path, 'source')
- source_url = download_actuals.create_filepath_url(source_path)
- with open(source_path, 'w') as source_handle:
- source_handle.write(contents)
- dest_path = os.path.join(tempdir_path, 'new_subdir', 'dest')
- # Destination subdir does not exist, so copy_contents() should fail
- # if create_subdirs_if_needed is False.
- with self.assertRaises(Exception):
- download_actuals.copy_contents(source_url=source_url,
- dest_path=dest_path,
- create_subdirs_if_needed=False)
- # If create_subdirs_if_needed is True, it should work.
- download_actuals.copy_contents(source_url=source_url,
- dest_path=dest_path,
- create_subdirs_if_needed=True)
- self.assertEquals(open(dest_path).read(), contents)
- finally:
- shutil.rmtree(tempdir_path)
-
def main():
base_unittest.main(DownloadTest)
« no previous file with comments | « gm/rebaseline_server/download_actuals.py ('k') | gm/rebaseline_server/fix_pythonpath.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698