robotcodedev / robotcode

RobotFramework support for Visual Studio Code
https://robotcode.io
Apache License 2.0
187 stars 15 forks source link

[BUG] Variable imports with the same file name, not the same directory, are not handled correctly #214

Closed johannesh closed 9 months ago

johannesh commented 10 months ago

Describe the bug Variables from variable files are displayed as not found if another variable file with the same name is imported. Tests run successfully, though, which makes debugging kind of tricky.

To Reproduce Steps to reproduce the behavior:

  1. Create two folders test_a and test_b
  2. Create a variables.yaml file with a least one variable in each folder and one in the root folder
  3. Create a robot file importing the yaml files and using that variables
  4. See error "Variable not found" - robotcode.namespace(VariableNotFound)
  5. Run the test and see all variables being logged correctly

If possible add some example source code like:

*** Settings ***
Documentation       This file outputs the variables import from variable files from
...                 different folders with the same name

Variables           variables.yaml
Variables           folder_a${/}variables.yaml
Variables           folder_b${/}variables.yaml

*** Test Cases ***
Test Case 1
    [Documentation]    This test case uses the variables from the variables.yaml file
    [Tags]    variables
    Log    ${VAR_A}
    Log    ${VAR_B}
    Log    ${VAR_C}

variable_test.zip

Expected behavior The variables of .yaml files should always be displayed.

Screenshots/ Videos Screenshot of issue image

Desktop:

d-biehl commented 9 months ago

this is a good finding and your example is helping me a lot. thanks!!!

the next release is on its way and it should fix it.