Skip to content

Allow setting variables for fixtures in a more generic way #2757

@ekouts

Description

@ekouts

The docs say:

-S, --setvar=[TEST.]VAR=VAL
Set variable VAR in all tests or optionally only in test TEST to VAL.
TEST can have the form [TEST.][FIXT.]*, in which case VAR will be set in fixture FIXT of TEST. Note that this syntax is recursive on fixtures, so that a variable can be set in a fixture arbitrarily deep. TEST prefix refers to the test class name, not the test name, but FIXT refers to the fixture name inside the referenced test.

As far as I can tell [TEST.][FIXT.]* is not correct. We can set a variable in all the non-fixture tests with -Svar=val but for fixtures we have to do it manually since FIXT is not the class name but the name inside a test. Also * doesn't work for me at all, not sure what a valid example would be.

I think we should extend -S and allow setting fixture variables more easily.

This is also slightly related to #2626 , since -S strict_check=1 is not really equivalent to --strict.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions