18 from .jsbuildingcontext
import JsBuildingContext
19 from .jsexecutionresult
import JsExecutionResult
22 STATUSES = {
'FAIL': 0,
'PASS': 1,
'SKIP': 2,
'NOT RUN': 3}
23 KEYWORD_TYPES = {
'KEYWORD': 0,
'SETUP': 1,
'TEARDOWN': 2,
24 'FOR': 3,
'ITERATION': 4,
25 'IF': 5,
'ELSE IF': 6,
'ELSE': 7,
26 'RETURN': 8,
'TRY': 9,
'EXCEPT': 10,
27 'FINALLY': 11,
'WHILE': 12,
'CONTINUE': 13,
'BREAK': 14}
32 def __init__(self, log_path=None, split_log=False, expand_keywords=None,
33 prune_input_to_save_memory=False):
35 prune_input_to_save_memory)
43 strings=self.
_context_context.strings,
44 basemillis=self.
_context_context.basemillis,
45 split_results=self.
_context_context.split_results,
46 min_level=self.
_context_context.min_level,
47 expand_keywords=self.
_context_context.expand_keywords
60 model = (STATUSES[item.status],
63 msg = getattr(item,
'message',
'')
66 elif msg.startswith(
'*HTML*'):
67 msg = self.
_string_string(msg[6:].lstrip(), escape=
False)
73 splitting = self.
_context_context.start_splitting_if_needed(split)
75 model = tuple([self.
_build_keyword_build_keyword(step)
for step
in steps])
76 return model
if not splitting
else self.
_context_context.end_splitting(model)
79 raise NotImplementedError
85 _Builder.__init__(self, context)
91 with self.
_context_context.prune_input(suite.tests, suite.suites):
93 kws = [kw
for kw
in (suite.setup, suite.teardown)
if kw]
94 return (self.
_string_string(suite.name, attr=
True),
95 self.
_string_string(suite.source),
96 self.
_context_context.relative_source(suite.source),
97 self.
_html_html(suite.doc),
100 tuple(self.
_build_suite_build_suite(s)
for s
in suite.suites),
101 tuple(self.
_build_test_build_test(t)
for t
in suite.tests),
106 for name, value
in suite.metadata.items():
107 yield self.
_string_string(name)
108 yield self.
_html_html(value)
111 stats = suite.statistics
112 return (stats.total, stats.passed, stats.failed, stats.skipped)
118 _Builder.__init__(self, context)
123 with self.
_context_context.prune_input(test.body):
124 return (self.
_string_string(test.name, attr=
True),
125 self.
_string_string(test.timeout),
126 self.
_html_html(test.doc),
127 tuple(self.
_string_string(t)
for t
in test.tags),
134 kws.append(test.setup)
135 kws.extend(test.body.flatten())
137 kws.append(test.teardown)
144 _Builder.__init__(self, context)
149 if item.type == item.MESSAGE:
154 self.
_context_context.check_expansion(kw)
155 items = kw.body.flatten()
157 items.append(kw.teardown)
158 with self.
_context_context.prune_input(kw.body):
159 return (KEYWORD_TYPES[kw.type],
160 self.
_string_string(kw.kwname, attr=
True),
161 self.
_string_string(kw.libname, attr=
True),
162 self.
_string_string(kw.timeout),
163 self.
_html_html(kw.doc),
164 self.
_string_string(
', '.join(kw.args)),
165 self.
_string_string(
', '.join(kw.assign)),
166 self.
_string_string(
', '.join(kw.tags)),
174 if msg.level
in (
'WARN',
'ERROR'):
175 self.
_context_context.create_link_target(msg)
176 self.
_context_context.message_level(msg.level)
177 return self.
_build_build(msg)
180 return (self.
_timestamp_timestamp(msg.timestamp),
182 self.
_string_string(msg.html_message, escape=
False))
188 return (self.
_build_stats_build_stats(statistics.total),
190 self.
_build_stats_build_stats(statistics.suite, exclude_empty=
False))
193 return tuple(stat.get_attributes(include_label=
True,
194 include_elapsed=
True,
195 exclude_empty=exclude_empty,
203 _Builder.__init__(self, context)
207 with self.
_context_context.prune_input(errors.messages):
208 return tuple(self.
_build_message_build_message(msg)
for msg
in errors)
214 model = self.
_build_build(msg)
215 link = self.
_context_context.link(msg)
216 return model
if link
is None else model + (link,)
def __init__(self, context)
def __init__(self, log_path=None, split_log=False, expand_keywords=None, prune_input_to_save_memory=False)
def build_from(self, result_from_xml)
def build(self, item, split=False)
def build_keyword(self, kw, split=False)
def __init__(self, context)
def _build_stats(self, stats, exclude_empty=True)
def build(self, statistics)
def __init__(self, context)
def _get_statistics(self, suite)
def _yield_metadata(self, suite)
def _get_keywords(self, test)
def __init__(self, context)
def __init__(self, context)
def _get_status(self, item)
def _build_keywords(self, steps, split=False)
def _build_keyword(self, step)