Skip to content

Commit

Permalink
For RF4 use body instead of keyword attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
aaltat committed Mar 29, 2021
1 parent 0fbb1ca commit 552ea52
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion robotstatuschecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@
import re
import sys

from robot import __version__ as rf_version
from robot.api import ExecutionResult, ResultVisitor
from robot.utils import Matcher


__version__ = 'devel'

RF4 = not rf_version.startswith("3")


def process_output(inpath, outpath=None, verbose=True):
"""The main programmatic entry point to status checker.
Expand Down Expand Up @@ -222,13 +225,18 @@ def _get_keyword(self, test, expected):
kw = None
try:
for index in expected.kw_index:
kw = (kw or test).keywords[index]
kw = self._get_keyword_rf_version(kw, test, index)
return kw
except IndexError:
message = "No keyword with index '%s'." % expected.kw_index_str
self._fail(test, message)
return None

def _get_keyword_rf_version(self, kw, test, index):
if not RF4:
return (kw or test).keywords[index]
return (kw or test).body[index]

def _check_message(self, test, kw, expected):
try:
msg = kw.messages[expected.msg_index]
Expand Down

0 comments on commit 552ea52

Please sign in to comment.