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

Unified Diff: gm/rebaseline_server/compare_rendered_pictures_test.py

Issue 397103003: combine base_unittest.py modules from gm and tools (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: pylint Created 6 years, 5 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
Index: gm/rebaseline_server/compare_rendered_pictures_test.py
diff --git a/gm/rebaseline_server/compare_rendered_pictures_test.py b/gm/rebaseline_server/compare_rendered_pictures_test.py
index 7656d11d100cc73df832205d9e84a794ea01dcba..a8041ec8025083b65edf5d42db7251303b29a6cb 100755
--- a/gm/rebaseline_server/compare_rendered_pictures_test.py
+++ b/gm/rebaseline_server/compare_rendered_pictures_test.py
@@ -10,23 +10,27 @@ Test compare_rendered_pictures.py
TODO(epoger): Create a command to update the expected results (in
self._output_dir_expected) when appropriate. For now, you should:
-1. examine the results in self._output_dir_actual and make sure they are ok
+1. examine the results in self.output_dir_actual and make sure they are ok
2. rm -rf self._output_dir_expected
-3. mv self._output_dir_actual self._output_dir_expected
+3. mv self.output_dir_actual self._output_dir_expected
Although, if you're using an SVN checkout, this will blow away .svn directories
within self._output_dir_expected, which wouldn't be good...
"""
+# System-level imports
import os
import subprocess
-import sys
+
+# Must fix up PYTHONPATH before importing from within Skia
+import fix_pythonpath # pylint: disable=W0611
# Imports from within Skia
import base_unittest
import compare_rendered_pictures
+import find_run_binary
+import gm_json
import results
-import gm_json # must import results first, so that gm_json will be in sys.path
class CompareRenderedPicturesTest(base_unittest.TestCase):
@@ -48,25 +52,25 @@ class CompareRenderedPicturesTest(base_unittest.TestCase):
})
results_obj = compare_rendered_pictures.RenderedPicturesComparisons(
- actuals_root=self._temp_dir,
+ actuals_root=self.temp_dir,
subdirs=('before_patch', 'after_patch'),
- generated_images_root=self._temp_dir,
+ generated_images_root=self.temp_dir,
diff_base_url='/static/generated-images')
results_obj.get_timestamp = mock_get_timestamp
gm_json.WriteToFile(
results_obj.get_packaged_results_of_type(
results.KEY__HEADER__RESULTS_ALL),
- os.path.join(self._output_dir_actual, 'compare_rendered_pictures.json'))
+ os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json'))
def _generate_skps_and_run_render_pictures(self, subdir, skpdict):
"""Generate SKPs and run render_pictures on them.
Args:
- subdir: subdirectory (within self._temp_dir) to write all files into
+ subdir: subdirectory (within self.temp_dir) to write all files into
skpdict: {skpname: redvalue} dictionary describing the SKP files to render
"""
- out_path = os.path.join(self._temp_dir, subdir)
+ out_path = os.path.join(self.temp_dir, subdir)
os.makedirs(out_path)
for skpname, redvalue in skpdict.iteritems():
self._run_skpmaker(
@@ -75,7 +79,7 @@ class CompareRenderedPicturesTest(base_unittest.TestCase):
# TODO(epoger): Add --mode tile 256 256 --writeWholeImage to the unittest,
# and fix its result! (imageURLs within whole-image entries are wrong when
# I tried adding that)
- binary = self.find_path_to_program('render_pictures')
+ binary = find_run_binary.find_path_to_program('render_pictures')
return subprocess.check_output([
binary,
'--config', '8888',
@@ -96,7 +100,7 @@ class CompareRenderedPicturesTest(base_unittest.TestCase):
width: Width of canvas to create.
height: Height of canvas to create.
"""
- binary = self.find_path_to_program('skpmaker')
+ binary = find_run_binary.find_path_to_program('skpmaker')
return subprocess.check_output([
binary,
'--red', str(red),

Powered by Google App Engine
This is Rietveld 408576698