Skip to content

Extend Config to override ini values programmatically #3311

@acerv

Description

@acerv

Hello, I'm trying to find a way to override custom ini values defined inside pytest.ini.

My scenario is the following: I have a custom option called --resource-enable which is implemented inside a plugin called "resources.py". If --resource-enable is used, my plugin fetch the configuration from a DB (dict type) and it has to override the pytest.ini variables defined inside the other plugins which expose the fixtures.

The system is needed in order to accomplish a complex automation scenario using Jenkins and some other proprietary tools.

In short:

  • all plugins implement fixtures which are used by the tests, using custom ini values defined inside pytest.ini
  • resources.py plugin fetches data from DB and override custom pytest.ini values before the tests execution

At the moment, there are no other ways but using config.addinivalue_line, but most of my ini items have the simple key=value form. A config.addinivalue would be really useful in this case.

Thanks,
Andrea

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: configrelated to config handling, argument parsing and config filetype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions