blob: 9d402afe5a750fbce6b760225165b1dd95c5da7c [file] [log] [blame]
David Bainbridge152bf5a2019-10-07 18:38:32 +00001# Copyright 2019 the original author or authors.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15from robot.libraries.BuiltIn import BuiltIn
16
17class DependencyLibrary(object):
18 ROBOT_LISTENER_API_VERSION = 2
19 ROBOT_LIBRARY_SCOPE = "GLOBAL"
20
21 def __init__(self):
22 self.ROBOT_LIBRARY_LISTENER = self
23 self.test_status = {}
24
25 def require_test_case(self, name):
26 key = name.lower()
27 if (key not in self.test_status):
28 BuiltIn().fail("required test case can't be found: '%s'" % name)
29
30 if (self.test_status[key] != "PASS"):
31 BuiltIn().fail("required test case failed: '%s'" % name)
32
33 return True
34
35 def _end_test(self, name, attrs):
36 self.test_status[name.lower()] = attrs["status"]