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

Side by Side Diff: gm/rebaseline_server/imagediffdb.py

Issue 397103003: combine base_unittest.py modules from gm and tools (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: everything but pylint cleanup 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 unified diff | Download patch
OLDNEW
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 Calulate differences between image pairs, and store them in a database. 9 Calulate differences between image pairs, and store them in a database.
10 """ 10 """
11 11
12 # System-level imports
12 import contextlib 13 import contextlib
13 import json 14 import json
14 import logging 15 import logging
15 import os 16 import os
16 import re 17 import re
17 import shutil 18 import shutil
18 import sys 19 import sys
19 import tempfile 20 import tempfile
20 import urllib 21 import urllib
21 22
22 # Set the PYTHONPATH to include the tools directory. 23 # Must fix up PYTHONPATH before importing from within Skia
23 sys.path.append( 24 import fix_pythonpath # pylint: disable=W0611
24 os.path.join( 25
25 os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, 26 # Imports from within Skia
26 'tools'))
27 import find_run_binary 27 import find_run_binary
28 28
29 SKPDIFF_BINARY = find_run_binary.find_path_to_program('skpdiff') 29 SKPDIFF_BINARY = find_run_binary.find_path_to_program('skpdiff')
30 30
31 DEFAULT_IMAGE_SUFFIX = '.png' 31 DEFAULT_IMAGE_SUFFIX = '.png'
32 DEFAULT_IMAGES_SUBDIR = 'images' 32 DEFAULT_IMAGES_SUBDIR = 'images'
33 33
34 DISALLOWED_FILEPATH_CHAR_REGEX = re.compile('[^\w\-]') 34 DISALLOWED_FILEPATH_CHAR_REGEX = re.compile('[^\w\-]')
35 35
36 RGBDIFFS_SUBDIR = 'diffs' 36 RGBDIFFS_SUBDIR = 'diffs'
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 330
331 Args: 331 Args:
332 expected_image_locator: locator string pointing at expected image 332 expected_image_locator: locator string pointing at expected image
333 actual_image_locator: locator string pointing at actual image 333 actual_image_locator: locator string pointing at actual image
334 334
335 Returns: already-sanitized locator where the diffs between expected and 335 Returns: already-sanitized locator where the diffs between expected and
336 actual images can be found 336 actual images can be found
337 """ 337 """
338 return "%s-vs-%s" % (_sanitize_locator(expected_image_locator), 338 return "%s-vs-%s" % (_sanitize_locator(expected_image_locator),
339 _sanitize_locator(actual_image_locator)) 339 _sanitize_locator(actual_image_locator))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698