-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Optionally suppress 'library contains no keywords' warning #5429
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
Comments
Suggested solution available in PR: #5421 auto_keywords=None suppresses 'library contains no keywords' warning |
Couldn't Also, is it |
Here are examples using the >>> from robot.utils import Importer
>>> Importer().import_class_or_module('os.path')
<module 'posixpath' (frozen)>
>>> Importer().import_class_or_module('robot.libraries.BuiltIn')
<class 'robot.libraries.BuiltIn.BuiltIn'>
>>> Importer().import_class_or_module(Path('foo.py').absolute())
<module 'foo' from '/home/peke/Devel/robotframework/foo.py'> The last example expects there to be file Notice also that the |
Thanks for the suggestions @pekkaklarck. You are right about the paths. Good guess, because that was not at all clear from my simplified example, I realise now. Anyway, I am sure one of your suggestions will work as well. I will leave it up to you what to do with this issue. Feel free to use the pull request as-is or in modified form if you think it is useful in some way. If you decide to reject this request that is also totally fine. In which case I will remove the pull request as well. |
When loading a library in Robot Framework that currently does not have any keywords, you get this warning:

Although mostly helpful, in certain situations I would like to suppress this warning.
I was looking for a simple way to allow extensions to my library. By simple, I mean from a user's perspective where the core is a piece of Python code. For some background; I expect students to do algorithm design and convert the algorithm to Python. We can then run the Robot test suite to check functionality and performance.
What I came up with is having a basic Python file that can be imported by Robot Framework and then pass this library as an argument to the host library. The host library resolves the dependency using
get_library_instance()
.In the broader sense it would not just be algorithms. I expect some of the extensions to also have keywords of their own. For the simple variants it will really just be a piece of code and importing as a library will yield a warning that the library does not contain any keywords. I would like to be able to suppress that warning in this situation.
The benefit of this approach is that one can do the configuration of the extension directly from Robot Framework. No need to fiddle around with
pythonpath
or other import structures. Just build on the back of Robot's library management.The text was updated successfully, but these errors were encountered: