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
Inconsistency importing "GLOBAL" library using "WITH NAME" with and without args #2931
I'm seeing an inconsistency when importing libraries:
When importing a library with "ROBOT_LIBRARY_SCOPE" set to "GLOBAL" and using different "WITH NAME" values, I'm seeing only one instance when executing tests in Robot Framework.
When importing a different "GLOBAL" library but specifying arguments using different "WITH NAME" values, I'm seeing two instances when executing tests.
*** Settings ***
LIBRARY ./LibImport.py WITH NAME libimport_1
LIBRARY ./LibImport.py WITH NAME libimport_2
LIBRARY ./LibImport2.py value_1 WITH NAME libimport2_1
LIBRARY ./LibImport2.py value_2 WITH NAME libimport2_2
*** Test Cases ***
Incremenent And Log Count For LibImport.py
libimport_1.Set Name libimport_1
libimport_2.Set Name libimport_2
libimport_1.Log Name
libimport_2.Log Name
Incremenent And Log Count For LibImport2.py
libimport2_1.Set Name libimport_1
libimport2_2.Set Name libimport_2
libimport2_1.Log Name
libimport2_2.Log Name
To replicate I'm just running this: robot -L trace test.robot
What I'm seeing is that the log keyword for LibImport.py will show "libimport_2" for both instances, while the ones for LibImport2.py will show "libimport_1", and "libimport_2" for the respective instances.
I took a quick look, and this seems happening when setting the import cache but I haven't had time to really test that theory.
For this case, I was actually hoping the library using LibImport2.py was the expected behavior. I was planning that as a workaround for the current framework I have. My main concern is using that workaround and watching everything break if I upgrade 😄.
I don't remember the details without looking at the code, but I'm fairly certain this behavior is by design. When you have a library that has a global scope, Robot avoids creating new instances, but when you take it into use with different arguments, that's just not possible.
Activity
pekkaklarck commentedon Aug 14, 2018
I don't remember the details without looking at the code, but I'm fairly certain this behavior is by design. When you have a library that has a global scope, Robot avoids creating new instances, but when you take it into use with different arguments, that's just not possible.
pekkaklarck commentedon Aug 14, 2018
This is to some extend related to #2106. The design can be reconsidered but definitely not in RF 3.1.
pekkaklarck commentedon Oct 3, 2018
Nothing will be done for this in the near future and we already have related #2106. I think this can be closed.