Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When library is using @keyword decorator to give new name for the keyword, then the method can not be called with the method name programmatically #2

Closed
aaltat opened this issue Nov 22, 2017 · 0 comments

Comments

@aaltat
Copy link
Contributor

aaltat commented Nov 22, 2017

Example if I have this code:

from robotlibcore import keyword
from robotlibcore import DynamicCore


class KwClass(object):

    @keyword('My Keyword')
    def my_kw(self):
        print 'My Kw'


class MyLibrary(DynamicCore):

    def __init__(self):
        DynamicCore.__init__(self, [KwClass()])


if __name__ == '__main__':
    x = MyLibrary()
    print x.keywords
    x.my_kw()

Then I can not call keyword with the method name my_kw and the above code raises:

{'My Keyword': <bound method KwClass.my_kw of <__main__.KwClass object at 0x059728D0>>}
Traceback (most recent call last):
  File "foo.py", line 21, in <module>
    x.my_kw()
  File "D:\workspace\SeleniumLibrary\src\SeleniumLibrary\base\robotlibcore.py", line 80, in __getattr__
    .format(type(self).__name__, name))
AttributeError: 'MyLibrary' object has no attribute 'my_kw'
@pekkaklarck pekkaklarck changed the title When library is using DynamicCore and use @keyword decorator to give new name for the keyword, then the method can not be called with the method name programmatically When library is using @keyword decorator to give new name for the keyword, then the method can not be called with the method name programmatically Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants