Skip to content

Conversation

@aaltat
Copy link
Contributor

@aaltat aaltat commented Mar 27, 2020

Fixes #26

@aaltat aaltat force-pushed the get_keyword_source branch from 64855f3 to 73c6cf4 Compare March 27, 2020 22:48
@aaltat aaltat merged commit be44564 into robotframework:master Mar 28, 2020
@aaltat aaltat deleted the get_keyword_source branch March 28, 2020 20:39
for line in source:
if line.strip().startswith('def'):
return line_number
line_number += 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this doesn't work correctly if someone has a library like this:

class LambdaLib:
    kw = lambda self: 42

Above is obviously rather strange but from RF point of view it's valid. I see two solutions:

  • Return the original line_number if def line isn't found at all.
  • Just return whatever getsourcelines returns.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bigger problem is that decorators returning different function than the original aren't supported correctly. Same issue on Robot side that the moment:
robotframework/robotframework#3516 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for get_keyword_source API method for Robot Framework 3.2

2 participants