Robot Framework Integrated Development Environment (RIDE)
suiteteardownfailed.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 from robotide.lib.robot.model import SuiteVisitor
17 
18 
20 
21  def end_suite(self, suite):
22  teardown = suite.keywords.teardown
23  # Both 'PASS' and 'NOT_RUN' (used in dry-run) statuses are OK.
24  if teardown and teardown.status == 'FAIL':
25  suite.suite_teardown_failed(teardown.message)
26 
27  def visit_test(self, test):
28  pass
29 
30  def visit_keyword(self, keyword):
31  pass
32 
33 
34 class SuiteTeardownFailed(SuiteVisitor):
35 
38  _normal_msg = 'Parent suite teardown failed:\n'
39 
42  _also_msg = '\n\nAlso parent suite teardown failed:\n'
43 
44  def __init__(self, error):
45  self._normal_msg_normal_msg += error
46  self._also_msg_also_msg += error
47 
48  def visit_test(self, test):
49  test.status = 'FAIL'
50  test.message += self._also_msg_also_msg if test.message else self._normal_msg_normal_msg
51 
52  def visit_keyword(self, keyword):
53  pass
Interface to ease traversing through a test suite structure.
Definition: visitor.py:75
def visit_test(self, test)
Implements traversing through the test and its keywords.
def visit_keyword(self, keyword)
Implements traversing through the keyword and its child keywords.
def visit_keyword(self, keyword)
Implements traversing through the keyword and its child keywords.
def visit_test(self, test)
Implements traversing through the test and its keywords.