Skip to content

Emit warning if same library is imported multiple times #5492

@pekkaklarck

Description

@pekkaklarck

At the moment if you import a library multiple times like

*** Settings ***
Library    Example
Library    Example

the library is imported every time, but latter imports are silently ignored because there's already a library imported with the same name. This is typically not a problem when a library accepts no arguments or if the library is used with same parameters, but in cases like

*** Settings ***
Library    Example    timeout=1
Library    Example    timeout=60

the latter import being silently ignored can cause a lot of confusion. In the above case it's easy to see there's something strange when both imports are in the same file, but the same problem occurs also if imports are, for example, in two different resource files that are both imported by a suite file.

As issue #5122 demonstrates, the problem with silently ignored imports occurs also when using import aliases if the same alias is reused.

To avoid these problems, I propose we start emitting a warning if a library is re-imported with the same name and the latter import is ignored. That way users immediately learn about ignored imports and can fix the situation.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions