diff options
author | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 11:18:50 +0000 |
---|---|---|
committer | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-24 11:18:50 +0000 |
commit | 7c0274ab4054cb92e5b134248de5b94308c10d36 (patch) | |
tree | 407e3856eb604004d5fa057cd1c73ea6b3eb7574 /mojo/tools | |
parent | fa86e4f7bebd6466e191ec557f6e5a5c33b28244 (diff) | |
download | chromium_src-7c0274ab4054cb92e5b134248de5b94308c10d36.zip chromium_src-7c0274ab4054cb92e5b134248de5b94308c10d36.tar.gz chromium_src-7c0274ab4054cb92e5b134248de5b94308c10d36.tar.bz2 |
Sync mojo_python_tests' JSON parsing up w/ telemetry.
The code to convert unittest results into a flakiness-compatible format
is duplicated across telemetry and mojo at the moment. This change merges
some fixes from the telemetry version into the mojo version.
R=dtu@chromium.org, vtl@chromium.org
Review URL: https://codereview.chromium.org/414873002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/tools')
-rwxr-xr-x | mojo/tools/run_mojo_python_tests.py | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/mojo/tools/run_mojo_python_tests.py b/mojo/tools/run_mojo_python_tests.py index fff10e3..778a575 100755 --- a/mojo/tools/run_mojo_python_tests.py +++ b/mojo/tools/run_mojo_python_tests.py @@ -6,7 +6,6 @@ import argparse import json import os -import re import sys import time import unittest @@ -98,7 +97,7 @@ def _FullResults(suite, result, metadata): for test_name in all_test_names: value = { 'expected': 'PASS', - 'actual': 'FAIL' if (test_name in failed_test_names) else 'FAIL', + 'actual': 'FAIL' if (test_name in failed_test_names) else 'PASS', } _AddPathToTrie(full_results['tests'], test_name, value) @@ -112,15 +111,12 @@ def _AllTestNames(suite): if isinstance(test, unittest.suite.TestSuite): test_names.extend(_AllTestNames(test)) else: - test_names.append(_UnitTestName(test)) + test_names.append(test.id()) return test_names def _FailedTestNames(result): - failed_test_names = set() - for (test, _) in result.failures + result.errors: - failed_test_names.add(_UnitTestName(test)) - return failed_test_names + return set(test.id() for test, _ in result.failures + result.errors) def _AddPathToTrie(trie, path, value): @@ -133,16 +129,5 @@ def _AddPathToTrie(trie, path, value): _AddPathToTrie(trie[directory], rest, value) -_UNITTEST_NAME_REGEX = re.compile("(\w+) \(([\w.]+)\)") - - -def _UnitTestName(test): - # This regex and UnitTestName() extracts the test_name in a way - # that can be handed back to the loader successfully. - m = _UNITTEST_NAME_REGEX.match(str(test)) - assert m, "could not find test name from test description %s" % str(test) - return "%s.%s" % (m.group(2), m.group(1)) - - if __name__ == '__main__': sys.exit(main()) |