summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2016-10-25 12:46:57 -0700
committerDylan Baker <dylan@pnwbakers.com>2016-10-26 11:38:24 -0700
commit8df09bfe03f0cd6e8bf284b22726c1274a3a7e42 (patch)
tree21763c2a434f006c21abd019e16c7fa7432f063c
parenta47c2fa787b9a084896b3ad020c27294df0a74df (diff)
framework: fix loading JUnit results
The JUnit loader was never updated to handle PID's as lists rather than a single int. This patch corrects that and allows JUnit results to be loaded again. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Tested-by: Mark Janes <mark.a.janes@intel.com>
-rw-r--r--framework/backends/junit.py6
-rw-r--r--unittests/framework/backends/test_junit.py6
2 files changed, 8 insertions, 4 deletions
diff --git a/framework/backends/junit.py b/framework/backends/junit.py
index 4c9b7afa9..018cecd2b 100644
--- a/framework/backends/junit.py
+++ b/framework/backends/junit.py
@@ -29,6 +29,10 @@ try:
from lxml import etree
except ImportError:
import xml.etree.cElementTree as etree
+try:
+ import simplejson as json
+except ImportError:
+ import json
import six
@@ -396,7 +400,7 @@ def _load(results_file):
result.time.end = float(line[len('time end: '):])
continue
elif line.startswith('pid:'):
- result.pid = int(line[len('pid: '):])
+ result.pid = json.loads(line[len('pid: '):])
continue
diff --git a/unittests/framework/backends/test_junit.py b/unittests/framework/backends/test_junit.py
index 6bc9e6aa6..06892ca73 100644
--- a/unittests/framework/backends/test_junit.py
+++ b/unittests/framework/backends/test_junit.py
@@ -56,7 +56,7 @@ _XML = """\
<system-out>this/is/a/command\nThis is stdout</system-out>
<system-err>this is stderr
-pid: 1934
+pid: [1934]
time start: 1.0
time end: 4.5
</system-err>
@@ -152,7 +152,7 @@ class TestProtectedLoad(object):
expected = textwrap.dedent("""\
this is stderr
- pid: 1934
+ pid: [1934]
time start: 1.0
time end: 4.5""")
assert result.tests[self.testname].err.strip() == expected
@@ -163,7 +163,7 @@ class TestProtectedLoad(object):
def test_pid(self, result):
"""backends.junit._load: pid is loaded correctly."""
- assert result.tests[self.testname].pid == 1934
+ assert result.tests[self.testname].pid == [1934]
class TestJUnitBackend(object):