You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Import Lib and Get Lib Instance doc clarifcation #2165
It would be good to have a description how the BuiltIn.Import Library behave if the library in question:
is already loaded (e.g. a new instance is created and the old one is discarded)
Is there a difference if Import Library is executed inside RF runtime (e.g. in a robot-file) or outside RF runtime (e.g. in MyOwnLib's init() method e.g. self._ssh = SSHLibrary() --> is the SSHLIbrary library instance now only available inside MyOwnLib or is it also available inside RF runtime)
and the same goes for BuiltIn.Get Library Instance i.e. what happens if the library in question:
is already loaded
is not yet loaded
This is important if the library in question is stateful.
Import Resource could also be documented similarly i.e. what happens with the variables imported from that resource file. Import Variables seems already have this info i.e. 'These variables override possible existing variables with the same names'.
Please clarify how you would like documentation to be enhanced. I read the description twice but couldn't understand it fully. Notice also that general questions should be rather sent to mailing list or other forums. This tracker is for bug reports and concrete enhancement requests.
How to import libraries is documented indeed, but how they behave if imported multiple times is not documented (or the documentation is inconsistent) - that's why I opened an issue.
Maybe I should have opened a couple of issues, because there are now a couple of topics here.
Anyway, I'll come up with more details ASAP - busy with some other stuff at the moment...
Import Library missing documentation:
What happens if the library is already imported in the current scope? i.e.
a) if the library contains variables are their values overwritten? I guess not
b) if the library is "stateful" (like SSHLibrary) is the state preserved (e.g. with SSH the status of the ssh connections)? I guess yes.
c) if the library supports arguments e.g. SSHLib already imported with timeout = 5s --> re-import with timeout = 15s --> what is now the timeout value after the 2nd import? still 5s
Import Resource missing documentation:
What happens if the resource is already imported in the current scope? i.e.
a) if the resource contains variables are their values overwritten? I guess not
Get Library Instance missing documentation:
a) what happens if the library is not loaded? --> KW fails i.e. one should run Import Library first.
Let me know if you agree with these updates. In that case I'll create a PR.
Depends is the library imported again with same arguments or not. In the former case the library is not imported again, but that is likely to change in RF 3.0 due to Imported libraries should not be cached #2106. Notice that I didn't understand what you mean with "library contains variables".
Get Library Instance fails if the specified library doesn't exist. I think that is pretty obvious, but making docs more explicit wouldn't harm.
I doubt it makes chance to update docs about 1. or 2. because they are likely to change in the next version. I actually think this whole issue should be closed in favor of #2106, #2099 and also #2101. Please submit a separate issue and pull request about enhancing Get Library Instance if you think it is important.
thanks
wrt 1) "with same arguments" do you refer to the WITH NAME syntax or MyLib my_arg=True syntax or both? #2105 mentions only WITH NAME #2106 would make things clearer - but could also break a lot of things, more in #2106
("contains variables" means either "has global variables that are used internally, more or less the same thing as stateful lib" or "imports variable into RF runtime e.g. like RemoteSwingLib imports ${REMOTESWINGLIBRARYPATH}" --> however the behaviour is now clear)
wrt 2) ok, same here - clearer but could break things
wrt 3) ok
and yeah, let's close this one. I'll make that PR.
With same arguments I meant both arguments passed to the library itself and possible WITH NAME usage. Notice that in both of these cases the old library stays imported too.
Activity
pekkaklarck commentedon Oct 1, 2015
Different ways to import libraries ought to be documented in the User Guide:
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-test-libraries
Please clarify how you would like documentation to be enhanced. I read the description twice but couldn't understand it fully. Notice also that general questions should be rather sent to mailing list or other forums. This tracker is for bug reports and concrete enhancement requests.
yahman72 commentedon Oct 2, 2015
How to import libraries is documented indeed, but how they behave if imported multiple times is not documented (or the documentation is inconsistent) - that's why I opened an issue.
Maybe I should have opened a couple of issues, because there are now a couple of topics here.
Anyway, I'll come up with more details ASAP - busy with some other stuff at the moment...
yahman72 commentedon Oct 9, 2015
As promised, more examples:
Import Librarymissing documentation:What happens if the library is already imported in the current scope? i.e.
a) if the library contains variables are their values overwritten? I guess not
b) if the library is "stateful" (like SSHLibrary) is the state preserved (e.g. with SSH the status of the ssh connections)? I guess yes.
c) if the library supports arguments e.g. SSHLib already imported with
timeout = 5s--> re-import withtimeout = 15s--> what is now thetimeoutvalue after the 2nd import? still 5sImport Resourcemissing documentation:What happens if the resource is already imported in the current scope? i.e.
a) if the resource contains variables are their values overwritten? I guess not
Get Library Instancemissing documentation:a) what happens if the library is not loaded? --> KW fails i.e. one should run
Import Libraryfirst.Let me know if you agree with these updates. In that case I'll create a PR.
pekkaklarck commentedon Oct 9, 2015
Answers:
Get Library Instancefails if the specified library doesn't exist. I think that is pretty obvious, but making docs more explicit wouldn't harm.I doubt it makes chance to update docs about 1. or 2. because they are likely to change in the next version. I actually think this whole issue should be closed in favor of #2106, #2099 and also #2101. Please submit a separate issue and pull request about enhancing
Get Library Instanceif you think it is important.yahman72 commentedon Oct 9, 2015
thanks
wrt 1) "with same arguments" do you refer to the
WITH NAMEsyntax orMyLib my_arg=Truesyntax or both? #2105 mentions onlyWITH NAME#2106 would make things clearer - but could also break a lot of things, more in #2106
("contains variables" means either "has global variables that are used internally, more or less the same thing as stateful lib" or "imports variable into RF runtime e.g. like RemoteSwingLib imports ${REMOTESWINGLIBRARYPATH}" --> however the behaviour is now clear)
wrt 2) ok, same here - clearer but could break things
wrt 3) ok
and yeah, let's close this one. I'll make that PR.
pekkaklarck commentedon Oct 9, 2015
With same arguments I meant both arguments passed to the library itself and possible
WITH NAMEusage. Notice that in both of these cases the old library stays imported too.