question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add RobotFramework library arguments support

See original GitHub issue

Problem description. For now, robocorp.robotframework-lsp-0.9.1 falls with error

Error creating libspec: SomeLibrary.
Return code: 252
Output:
Library 'SomeLibrary' expected 2 to 3 arguments, got 0.

if any count of args required for a user RobotFramework library.

Possible solution Probably robotframework-lsp could detect a types of arguments using typehints and use this info to generate lib specs with the correct libdoc call. If it’s not possible then some kind of configuration option could be provided in setting.json to match lib name and default arguments. Or it could be any other special description file in the workspace.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
mrdimfoxcommented, Mar 18, 2021

Cool! Thank you. I’ll try it.

Update: It actually works! Awesome! I can just put <package>.<RobotLib>.libspec file into my python package which contains a RobotFramework library and LSP can find it without any problems! Here is an example of a libdoc call for a libspec generation for lib with two args:

python -m robot.libdoc --format XML my_package.robot.KeywordsLibrary::arg1::agr2 my_package.robot.KeywordsLibrary.libspec
1reaction
fabiozcommented, Mar 18, 2021

The usual command line would be:

python -m robot.libdoc --format XML:HTML <library_name> <library_name.libspec>

As you have custom usage for the parameters, you may want to take a look at: python -m robot.libdoc -h to see how to tackle that.

You can just place the .libspec under a file anywhere in the workspace or directly under some entry in the PYTHONPATH and the language server should find it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Robot Framework User Guide
The setup.py script accepts several arguments allowing, for example, installation into a non-default location that does not require administrative rights. It ...
Read more >
Robot Framework cheat sheet and quick reference - Robocorp
Use it in your daily development to look up how to work with tasks, keywords, arguments, for loops, conditional if / else /...
Read more >
Support keyword-only arguments in Python 3 libraries #2555
If library contains function like function(*variable_arguments, __helper_functions) import failed with [ ERROR ] Adding keyword 'function' ...
Read more >
Importing libraries with parameters writen in Python to Robot ...
The typical solution for this is to make the arguments to your library optional. That way tools like libdoc or eclipse can import...
Read more >
Create Custom Robot Framework Libraries
Robot Framework supports numerous libraries which can be used ... the Retrieve Employees List by adding the APPLICATION_PATH as an argument, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found