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

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

Issue 252583005: rebaseline_server unittests: output tkdiff lines when actuals don't match expectations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 """ 3 """
4 Copyright 2014 Google Inc. 4 Copyright 2014 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 A wrapper around the standard Python unittest library, adding features we need 9 A wrapper around the standard Python unittest library, adding features we need
10 for various unittests within this directory. 10 for various unittests within this directory.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 # to be validated. 42 # to be validated.
43 # 2. So put that validation within tearDown(), which will be called after 43 # 2. So put that validation within tearDown(), which will be called after
44 # every test case! 44 # every test case!
45 # 45 #
46 # I have confirmed that the test really does fail if this assert is 46 # I have confirmed that the test really does fail if this assert is
47 # triggered. 47 # triggered.
48 # 48 #
49 # Ravi notes: if somebody later comes along and adds cleanup code below 49 # Ravi notes: if somebody later comes along and adds cleanup code below
50 # this assert, then if tests fail, the artifacts will not be cleaned up. 50 # this assert, then if tests fail, the artifacts will not be cleaned up.
51 assert (not different_files), \ 51 assert (not different_files), \
52 ('found differing files between actual dir %s and expected dir %s: %s' % 52 ('found differing files:\n' +
53 (self._output_dir_actual, self._output_dir_expected, different_files)) 53 '\n'.join(['tkdiff %s %s &' % (
54 os.path.join(self._output_dir_actual, basename),
55 os.path.join(self._output_dir_expected, basename))
56 for basename in different_files]))
54 57
55 def shortDescription(self): 58 def shortDescription(self):
56 """Tell unittest framework to not print docstrings for test cases.""" 59 """Tell unittest framework to not print docstrings for test cases."""
57 return None 60 return None
58 61
59 62
60 def create_empty_dir(path): 63 def create_empty_dir(path):
61 """Create an empty directory at the given path.""" 64 """Create an empty directory at the given path."""
62 if os.path.isdir(path): 65 if os.path.isdir(path):
63 shutil.rmtree(path) 66 shutil.rmtree(path)
(...skipping 27 matching lines...) Expand all
91 for common_dir in dircmp.common_dirs: 94 for common_dir in dircmp.common_dirs:
92 differing_files.extend(find_different_files( 95 differing_files.extend(find_different_files(
93 os.path.join(dir1, common_dir), os.path.join(dir2, common_dir))) 96 os.path.join(dir1, common_dir), os.path.join(dir2, common_dir)))
94 return differing_files 97 return differing_files
95 98
96 99
97 def main(test_case_class): 100 def main(test_case_class):
98 """Run the unit tests within the given class.""" 101 """Run the unit tests within the given class."""
99 suite = unittest.TestLoader().loadTestsFromTestCase(test_case_class) 102 suite = unittest.TestLoader().loadTestsFromTestCase(test_case_class)
100 results = unittest.TextTestRunner(verbosity=2).run(suite) 103 results = unittest.TextTestRunner(verbosity=2).run(suite)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698