Skip to content

Expand Library Name Aliases when using Evaluate #5427

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

Open
nickfinestead opened this issue May 9, 2025 · 0 comments
Open

Expand Library Name Aliases when using Evaluate #5427

nickfinestead opened this issue May 9, 2025 · 0 comments

Comments

@nickfinestead
Copy link

nickfinestead commented May 9, 2025

For the following robot file and version

Version: Robot Framework 7.2.2 (Python 3.12.3 on linux)

*** Settings ***
Library  main    AS  Custom

*** Test Cases ***
Verify Add
    ${result}=  Evaluate  Custom.add(1,2)
    Log To Console   ${result}

With the following python file named main.py (For simplicity sake)

def add(a, b):
    return a + b

The following error is outputted

Evaluating expression 'Custom.add(1,2)' failed: NameError: name 'Custom' is not defined nor importable as module

Whereas, this input works as expected, and outputs 3

*** Settings ***
Library  main

*** Test Cases ***
Verify Add
    ${result}=  Evaluate  main.add(1,2)
    Log To Console   ${result}

It would be nice to possibly expand aliases for Library Names when using Python Expressions so you can use alias instead of the full library name. This would be useful for evaluating expressions in the robot file instead of resorting to storing paths in variables, etc. I'm currently working on a solution and will open a PR when ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant