Skip done from Python library keyword shows error in log

I have these test cases in a test suite
*** Test Cases ***

Test Robot Skip
    Skip  Skip done from .robot

Test Python Skip
    My Own Skip  Skip done from .py

And this keyword defined in a keyword library
class KwLibrary:

    @keyword
    def my_own_skip(self, msg: str):
        BuiltIn().skip(msg)

This results in a log file like:

Why does the skip from keyword library show error in log but not the one called directly in test suite? How could I skip test case in the library keyword without showing error in log?

@Vahv1 Do you have the following import in your custom Python library?

from robot.libraries.BuiltIn import BuiltIn

The following works for me:

from robot.api.deco import keyword
from robot.libraries.BuiltIn import BuiltIn

class CustomLibrary:

    @keyword
    def my_own_skip(self, msg: str):
        BuiltIn().skip(msg)

Yes, I have those exact same imports. Just to make sure, so you don’t get an error in the test run log when using that? The skip works for me too and the test case doesn’t fail. But I’d like to get rid of the unnecessary error in the log.

@Vahv1 I don’t get an error: https://robotframework.org/code/?codeProject=N4IgdghgtgpiBcIDKBLKAHANjABAUQA9os4AaEAExgGcBjAJxXQBcUB7MBEEcgMxWzUEAbVD9sAOWhxEAFRrMkAVxTMYAOnpsARm2Y8QtDmrD7EAKks4kMZqzABzajkvmAOmAAibWktimIVg4cEJCAKSVqZhwIHDUo6hU1DwAZFG16CHoAT1C8vIBhSOY2KDSMrOz1dGyPD1cceSicAohqGhdLDybogCUdPWsAayYPPKQR9BCJphwKDlxeLSgcTQHmOrAenAAFbOYAC2CZ9DHQgFlcgHkAdzBh2Yep+bBF5dWakABfUjEBGCksC4Qxg2RubHoFGomhobCU9FoZEMxhgpi4DRsdhQjmcrg83l8-mYgXY91CEj0B2xDjibBw7TgPz+kmkXCKUVK5UyOWq2QMRlMqLMICWpRwWl0zHUEHQKHUVCMODQ6Ah0RBYIhFA8opWEr06kw6W5KBo6gAQipMMwAJL3ZWqnAWgQ2sCbWiYNrOdklMpGyrwTZ5AAC6vBkLOISovBwUGyAH02Hc49RJgAKdqYXikGPUBzwenMegASgDZPyjstLtTRfUKaYqaguaL3wAuuQqIwAG4wCg7LQAKxgtDMhaUMHIeuYADUYPRqKSuAB2dQABgMk4AgvQnAhgD8QPQYABHFSHolCeDCFtfIA

I see, should’ve thought of that. Found out that the culprit was our custom implementation of run_keyword-method. Thanks for the help!

1 Like