Skip to content

'Set Library Search Order' not working when same keyword is used in both a Robot resources and a Python library #4845

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

Closed
MaximeAbout opened this issue Aug 24, 2023 · 1 comment

Comments

@MaximeAbout
Copy link

MaximeAbout commented Aug 24, 2023

Hello,

I'm using RF 6.1
Here my test:

TATA.py

from robot.api.deco import keyword

class TATA:
    @keyword("Test")
    def Test(self):
        logger.info(f'Tata')

TOTO.robot

*** Settings ***
Documentation  Resource for manipulating the VirtualBox VM
Library  BuiltIn

*** Keywords ***
Test
    [Documentation]    Open SSH connection To Distant Host (not applicable for VBOX)
    Log  Toto  console=True

bac_a_sable.robot:


*** Settings ***
Library         ${PROJECT}/libs/TATA.py
Resource        ${PROJECT}/resources/TOTO.robot

*** Test Cases ***
Mytest
    Set Library Search Order  TOTO  TATA  
    Test
    Set Library Search Order  TATA  TOTO  
    Test

image

Current result : a "Log Toto" in both case
Expected result: a "Log Toto" in first Test keyword call and a "Tata" logged in the second

This issue seems to be located robotframework/src/robot/running/namespace.py line 173-175:

    def _get_implicit_runner(self, name):
        return (self._get_runner_from_resource_files(name) or
                self._get_runner_from_libraries(name))
@pekkaklarck
Copy link
Member

This is by design, resource files always have higher precedence than libraries. This design could be changed, but I don't consider it too high priority. If someone is interested to look at this, the behavior could be changed already in RF 7, but otherwise this needs to wait until we make other changes to the related code.

@pekkaklarck pekkaklarck closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2025
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