Skip to content

Document that Run Keyword variants do not support named arguments #5025

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
MaxRau opened this issue Jan 17, 2024 · 2 comments
Open

Document that Run Keyword variants do not support named arguments #5025

MaxRau opened this issue Jan 17, 2024 · 2 comments
Milestone

Comments

@MaxRau
Copy link

MaxRau commented Jan 17, 2024

Robot Framework Version: 7.0 (also occurs on 6.1.1)
Python interpreter version: 3.11.3
OS: Windows 10 and RHEL

Run Keyword and Expect Error fails when expected_error is a named argument (expected_error=thing) it will look for an error beginning with the string expected_error=

Example passing and failing TC using positional and named arg respectively

*** Test Cases ***
TestExpectErrorPositionalArg
Run Keyword And Expect Error
... REGEXP:^.abc123.$
... Fail
... msg=Error message including substring abc123 to be matched against

TestExpectErrorNamedArg
Run Keyword And Expect Error
... expected_error=REGEXP:^.abc123.$
... Fail
... msg=Error message including substring abc123 to be matched against

Error message from test2:
Expected error '**expected_error=**REGEXP:^.abc123.$' but got 'Error message including substring abc123 to be matched against'.

You can see that it is searching for a literal string beginning with expected_error= and REGEX prefix isn't considered to be at beginning of line so isn't parsed.

I think as written the _error_is_expected function doesn't handle named variables correctly.

@pekkaklarck
Copy link
Member

expected_error cannot be apecies as a named argument. Other Run Keyword variants have the same limitation. This needs to be documented

@pekkaklarck pekkaklarck added this to the v7.4 milestone May 20, 2025
@pekkaklarck pekkaklarck changed the title Run Keyword and Expect Error fails with named arguments Document that Run Keyword variants do not support named arguments May 20, 2025
@pekkaklarck
Copy link
Member

Keywords executed by these keywords support named args. Mixing them with arguments used by these keywords themselves wouldn't work.

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

2 participants