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

Add library and resource file import related methods to listener version 3 #5008

Open
pekkaklarck opened this issue Jan 10, 2024 · 4 comments

Comments

@pekkaklarck
Copy link
Member

pekkaklarck commented Jan 10, 2024

Listener version 3 was initially implemented in RF 3.0 (#1208). It didn't have start/end_keyword methods nor methods related to library, resource file and variable file imports because implementing them would have been too big task. It finally got keyword and control structure related methods in RF 7.0 (#3296), but it still lacks methods related to library, resource file and variable file imports.

Listener version 2 has methods library_import, resource_import and variables_import, and we probably should use same name with listener version 3 as well. With listener version 2 all these methods the name of the imported thing and a dictionary containing other information as arguments. With listener version 3 we want to pass the real model objects instead similarly as we do with start/end methods. Listeners should be able to modify at least resource files but preferably also libraries and variable files.

The good news is that implementing start/end_keyword methods required refactoring also library and resource file related model objects and they both ought to be in good enough shape to be used directly. With variable files we don't have such a good model object yet, but creating one shouldn't be too complicated. If it turns out to be hard, just adding methods for libraries and resource files and delaying adding methods for variable files is fine as well.

I consider this pretty high priority because after that listener version 3 can handle everything that listener version 2 can.


UPDATE: We'll only add library and resource file import methods in RF 7.1. We'll add the variable file import method when we have a suitable model object available (#5116).

@Snooz82
Copy link
Member

Snooz82 commented Mar 26, 2024

When this is implemented we should probably fix the following situation:

https://robotframework.slack.com/archives/C0K0240NL/p1708297275219929?thread_ts=1708253100.376219&cid=C0K0240NL

        resources = BuiltIn()._namespace._kw_store.resources._items
        kws = [ KeywordDocBuilder().build_keywords(resource) for resource in resources]

When calling that on a resource object, KeywordDocBuilder does somehow replace the actual default value variables with its name as strings.

image

@pekkaklarck
Copy link
Member Author

The issue you @Snooz82 reported doesn't seem to be too much related to the possible new listener methods. Could you submit a separate issue with some more information and a bit more detailed explanation how to reproduce the problem?

@pekkaklarck
Copy link
Member Author

We won't have time to add suitable model object representing variable files in RF 7.1. I believe it's better to do that later when we are also otherwise making bigger changes to variable namespaces. Adding methods for libraries and resource files ought to be easy because the new model objects introduced in RF 7.0 ought to be usable as-is. Let's add those methods now and add the variable file method later. I'll submit a separate issue about that.

@pekkaklarck
Copy link
Member Author

Adding the variable file import method is covered by #5116.

@pekkaklarck pekkaklarck changed the title Add library, resource file and variable file import related methods to listener version 3 Add library and resource file import related methods to listener version 3 Apr 17, 2024
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