blob: b635e4ece2bfd48a93b1e716d4ae04aae538e9b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.result import Result
class ResultSet(JenkinsBase):
"""
Represents a result from a completed Jenkins run.
"""
def __init__(self, url, build):
"""
Init a resultset
:param url: url for a build, str
:param build: build obj
"""
self.build = build
JenkinsBase.__init__(self, url)
def get_jenkins_obj(self):
return self.build.job.get_jenkins_obj()
def __str__(self):
return "Test Result for %s" % str(self.build)
@property
def name(self):
return str(self)
def keys(self):
return [a[0] for a in self.iteritems()]
def items(self):
return [a for a in self.iteritems()]
def iteritems(self):
for suite in self._data.get("suites", []):
for case in suite["cases"]:
R = Result(**case)
yield R.id(), R
for report_set in self._data.get("childReports", []):
for suite in report_set["result"]["suites"]:
for case in suite["cases"]:
R = Result(**case)
yield R.id(), R
def __len__(self):
return len(self.items())
|