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

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: 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 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 tempfile 19 import tempfile
20 import urllib 20 import urllib
21 21
22 # Set the PYTHONPATH to include the tools directory. 22 # Must fix up PYTHONPATH before importing from within Skia
23 sys.path.append( 23 import fix_pythonpath # pylint: disable=W0611
24 os.path.join( 24
25 os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, 25 # Imports from within Skia
26 'tools'))
27 import find_run_binary 26 import find_run_binary
28 27
29 SKPDIFF_BINARY = find_run_binary.find_path_to_program('skpdiff') 28 SKPDIFF_BINARY = find_run_binary.find_path_to_program('skpdiff')
30 29
31 DEFAULT_IMAGE_SUFFIX = '.png' 30 DEFAULT_IMAGE_SUFFIX = '.png'
32 DEFAULT_IMAGES_SUBDIR = 'images' 31 DEFAULT_IMAGES_SUBDIR = 'images'
33 32
34 DISALLOWED_FILEPATH_CHAR_REGEX = re.compile('[^\w\-]') 33 DISALLOWED_FILEPATH_CHAR_REGEX = re.compile('[^\w\-]')
35 34
36 RGBDIFFS_SUBDIR = 'diffs' 35 RGBDIFFS_SUBDIR = 'diffs'
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 329
331 Args: 330 Args:
332 expected_image_locator: locator string pointing at expected image 331 expected_image_locator: locator string pointing at expected image
333 actual_image_locator: locator string pointing at actual image 332 actual_image_locator: locator string pointing at actual image
334 333
335 Returns: already-sanitized locator where the diffs between expected and 334 Returns: already-sanitized locator where the diffs between expected and
336 actual images can be found 335 actual images can be found
337 """ 336 """
338 return "%s-vs-%s" % (_sanitize_locator(expected_image_locator), 337 return "%s-vs-%s" % (_sanitize_locator(expected_image_locator),
339 _sanitize_locator(actual_image_locator)) 338 _sanitize_locator(actual_image_locator))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698