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

Side by Side Diff: mojo/tools/run_mojo_python_tests.py

Issue 430933004: Mark json results failures as unexpected in python tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix copy/paste into mini_installer Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import json 7 import json
8 import os 8 import os
9 import sys 9 import sys
10 import time 10 import time
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 failed_test_names = _FailedTestNames(result) 88 failed_test_names = _FailedTestNames(result)
89 89
90 full_results['num_failures_by_type'] = { 90 full_results['num_failures_by_type'] = {
91 'FAIL': len(failed_test_names), 91 'FAIL': len(failed_test_names),
92 'PASS': len(all_test_names) - len(failed_test_names), 92 'PASS': len(all_test_names) - len(failed_test_names),
93 } 93 }
94 94
95 full_results['tests'] = {} 95 full_results['tests'] = {}
96 96
97 for test_name in all_test_names: 97 for test_name in all_test_names:
98 value = { 98 value = {}
99 'expected': 'PASS', 99 value['expected'] = 'PASS'
100 'actual': 'FAIL' if (test_name in failed_test_names) else 'PASS', 100 if test_name in failed_test_names:
101 } 101 value['actual'] = 'FAIL'
102 value['is_unexpected'] = True
103 else:
104 value['actual'] = 'PASS'
102 _AddPathToTrie(full_results['tests'], test_name, value) 105 _AddPathToTrie(full_results['tests'], test_name, value)
103 106
104 return full_results 107 return full_results
105 108
106 109
107 def _AllTestNames(suite): 110 def _AllTestNames(suite):
108 test_names = [] 111 test_names = []
109 # _tests is protected pylint: disable=W0212 112 # _tests is protected pylint: disable=W0212
110 for test in suite._tests: 113 for test in suite._tests:
111 if isinstance(test, unittest.suite.TestSuite): 114 if isinstance(test, unittest.suite.TestSuite):
(...skipping 12 matching lines...) Expand all
124 trie[path] = value 127 trie[path] = value
125 return 128 return
126 directory, rest = path.split(TEST_SEPARATOR, 1) 129 directory, rest = path.split(TEST_SEPARATOR, 1)
127 if directory not in trie: 130 if directory not in trie:
128 trie[directory] = {} 131 trie[directory] = {}
129 _AddPathToTrie(trie[directory], rest, value) 132 _AddPathToTrie(trie[directory], rest, value)
130 133
131 134
132 if __name__ == '__main__': 135 if __name__ == '__main__':
133 sys.exit(main()) 136 sys.exit(main())
OLDNEW
« no previous file with comments | « chrome/test/mini_installer/test_installer.py ('k') | tools/telemetry/telemetry/unittest/json_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698