Skip to content

BuiltIn: Explicitly mark arguments that are positional-only  #5025

@MaxRau

Description

@MaxRau

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.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions