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

Side by Side Diff: sky/tools/webkitpy/test/main_unittest.py

Issue 639883003: Get test_webkitpy to actually run again. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: merge to ToT Created 6 years, 1 month 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 | « sky/tools/webkitpy/test/main.py ('k') | sky/tools/webkitpy/test/runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2012 Google, Inc. 1 # Copyright (C) 2012 Google, Inc.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions 4 # modification, are permitted provided that the following conditions
5 # are met: 5 # are met:
6 # 1. Redistributions of source code must retain the above copyright 6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # 2. Redistributions in binary form must reproduce the above copyright 8 # 2. Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the 9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution. 10 # documentation and/or other materials provided with the distribution.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 tester._options, args = tester._parse_args(args) 72 tester._options, args = tester._parse_args(args)
73 return tester._test_names(unittest.TestLoader(), args) 73 return tester._test_names(unittest.TestLoader(), args)
74 74
75 def test_individual_names_are_not_run_twice(self): 75 def test_individual_names_are_not_run_twice(self):
76 args = [STUBS_CLASS + '.test_empty'] 76 args = [STUBS_CLASS + '.test_empty']
77 tests = self._find_test_names(args) 77 tests = self._find_test_names(args)
78 self.assertEqual(tests, args) 78 self.assertEqual(tests, args)
79 79
80 def test_coverage_works(self): 80 def test_coverage_works(self):
81 # This is awkward; by design, running test-webkitpy -c will 81 # This is awkward; by design, running test-webkitpy -c will
82 # create a .coverage file in Tools/Scripts, so we need to be 82 # create a .coverage file in tools, so we need to be
83 # careful not to clobber an existing one, and to clean up. 83 # careful not to clobber an existing one, and to clean up.
84 # FIXME: This design needs to change since it means we can't actually 84 # FIXME: This design needs to change since it means we can't actually
85 # run this method itself under coverage properly. 85 # run this method itself under coverage properly.
86 filesystem = FileSystem() 86 filesystem = FileSystem()
87 executive = Executive() 87 executive = Executive()
88 module_path = filesystem.path_to_module(self.__module__) 88 module_path = filesystem.path_to_module(self.__module__)
89 script_dir = module_path[0:module_path.find('webkitpy') - 1] 89 script_dir = module_path[0:module_path.find('webkitpy') - 1]
90 coverage_file = filesystem.join(script_dir, '.coverage') 90 coverage_file = filesystem.join(script_dir, '.coverage')
91 coverage_file_orig = None 91 coverage_file_orig = None
92 if filesystem.exists(coverage_file): 92 if filesystem.exists(coverage_file):
93 coverage_file_orig = coverage_file + '.orig' 93 coverage_file_orig = coverage_file + '.orig'
94 filesystem.move(coverage_file, coverage_file_orig) 94 filesystem.move(coverage_file, coverage_file_orig)
95 95
96 try: 96 try:
97 proc = executive.popen([sys.executable, filesystem.join(script_dir, 'test-webkitpy'), '-c', STUBS_CLASS + '.test_empty'], 97 proc = executive.popen([sys.executable, filesystem.join(script_dir, 'test-webkitpy'), '-c', STUBS_CLASS + '.test_empty'],
98 stdout=executive.PIPE, stderr=executive.PIPE) 98 stdout=executive.PIPE, stderr=executive.PIPE)
99 out, _ = proc.communicate() 99 out, _ = proc.communicate()
100 retcode = proc.returncode 100 retcode = proc.returncode
101 self.assertEqual(retcode, 0) 101 self.assertEqual(retcode, 0)
102 self.assertIn('Cover', out) 102 self.assertIn('Cover', out)
103 finally: 103 finally:
104 if coverage_file_orig: 104 if coverage_file_orig:
105 filesystem.move(coverage_file_orig, coverage_file) 105 filesystem.move(coverage_file_orig, coverage_file)
106 elif filesystem.exists(coverage_file): 106 elif filesystem.exists(coverage_file):
107 filesystem.remove(coverage_file) 107 filesystem.remove(coverage_file)
OLDNEW
« no previous file with comments | « sky/tools/webkitpy/test/main.py ('k') | sky/tools/webkitpy/test/runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698