Skip to content

Expand Library Name Aliases when using Evaluate #5427

Open
@nickfinestead

Description

@nickfinestead

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions