robotframework-lsp icon indicating copy to clipboard operation
robotframework-lsp copied to clipboard

Running the RETURN statement example from robotframework.org will get error.

Open hevinhsu opened this issue 2 years ago • 2 comments

Describe the bug Test failed when execute the RETURN statement. I run the sample code from robotframework.org and got the error: [FAIL] 'Return' is a reserved keyword. But I use the command:robot xxx.robot the test will pass.

To Reproduce Steps to reproduce the behavior:

  1. execute these sample code using plugin
*** Keywords ***
Return Three Values
  [Documentation]    Return multiple values.
  RETURN    a    b    c

*** Test Cases ***
Multiple return values
  ${a}    ${b}    ${c} =    Return Three Values
  Should Be Equal    ${a}, ${b}, ${c}    a, b, c
  1. See the error logs belog:
Started: D:\testProject\python_project\robot_test\robot\test.robot
==============================================================================
Test                                                                          
==============================================================================
Traceback (most recent call last):
  File "C:\Users\xxx\AppData\Roaming\JetBrains\PyCharm2022.2\plugins\robotframework-intellij\lib\robotframework_debug_adapter\listeners.py", line 17, in __call__
    c(*args, **kwargs)
  File "C:\Users\xxx\AppData\Roaming\JetBrains\PyCharm2022.2\plugins\robotframework-intellij\lib\robotframework_debug_adapter\debugger_impl.py", line 1227, in start_test
    _TestEntry(data.name, self._source_as_str(data.source), data.lineno, "TEST")
AttributeError: 'TestCase' object has no attribute 'source'
robot: 2023-02-23 15:31:37 UTC pid: 9832 - MainThread - CRITICAL - robotframework_debug_adapter.debugger_impl
Robot Debugger Warning: unable to pop TEST - Multiple return values because it does not match the current top: SUITE - Test

Multiple return values                                                | FAIL |
'Return' is a reserved keyword.
------------------------------------------------------------------------------
Test                                                                  | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  D:\testProject\python_project\robot_test\log\output.xml
[FAIL] 'Return' is a reserved keyword.
Log:     D:\testProject\python_project\robot_test\log\log.html
Report:  D:\testProject\python_project\robot_test\log\report.html
-- Closing logging streams --
Robot Run Terminated (code: 0)

Screenshots image

Versions:

  • OS: Windows 10
  • Robot Framework Version: 6.0.2
  • Robot Framework Language Server Version: 1.9.0
  • Client Version: PyCharm 2022.2.2

hevinhsu avatar Feb 23 '23 07:02 hevinhsu

I believe this is because it's picking up an older version of Robot Framework.

Can you try to set the Language Server Python setting to the python you expect to be used?

i.e.: image

fabioz avatar Mar 03 '23 12:03 fabioz

Thank you for the updated information. However, the suggested solution did not work for me. I have checked the version of robotframework I am using and it does not seem to be the issue. Do you have any other suggestions that I could try?

my Language Server Python setting: try_the_settings

libraries: usaged_library

error message:

Started: D:\testProject\python_project\robot_test\robot\test.robot
==============================================================================
Test                                                                          
==============================================================================
Traceback (most recent call last):
  File "C:\Users\hevin.hsu.h.w\AppData\Roaming\JetBrains\PyCharm2022.2\plugins\robotframework-intellij\lib\robotframework_debug_adapter\listeners.py", line 17, in __call__
    c(*args, **kwargs)
  File "C:\Users\hevin.hsu.h.w\AppData\Roaming\JetBrains\PyCharm2022.2\plugins\robotframework-intellij\lib\robotframework_debug_adapter\debugger_impl.py", line 1227, in start_test
    _TestEntry(data.name, self._source_as_str(data.source), data.lineno, "TEST")
AttributeError: 'TestCase' object has no attribute 'source'
robot: 2023-03-06 09:14:33 UTC pid: 23376 - MainThread - CRITICAL - robotframework_debug_adapter.debugger_impl
Robot Debugger Warning: unable to pop TEST - Multiple return values because it does not match the current top: SUITE - Test

Multiple return values                                                | FAIL |
'Return' is a reserved keyword.
------------------------------------------------------------------------------
[FAIL] 'Return' is a reserved keyword.
Traceback (most recent call last):
  File "C:\Users\hevin.hsu.h.w\AppData\Roaming\JetBrains\PyCharm2022.2\plugins\robotframework-intellij\lib\robotframework_debug_adapter\listeners.py", line 17, in __call__
    c(*args, **kwargs)
  File "C:\Users\hevin.hsu.h.w\AppData\Roaming\JetBrains\PyCharm2022.2\plugins\robotframework-intellij\lib\robotframework_debug_adapter\debugger_impl.py", line 1227, in start_test
    _TestEntry(data.name, self._source_as_str(data.source), data.lineno, "TEST")
AttributeError: 'TestCase' object has no attribute 'source'
robot: 2023-03-06 09:14:33 UTC pid: 23376 - MainThread - CRITICAL - robotframework_debug_adapter.debugger_impl
Robot Debugger Warning: unable to pop TEST - Embedded arguement Test because it does not match the current top: SUITE - Test

hevinhsu avatar Mar 06 '23 01:03 hevinhsu