Skip to content

Disable plugin autoload via configuration file #8969

Closed

Description

@guludo

What's the problem this feature will solve?

I want to use a plugin only when certain conditions are met. Currently, in order to do that I can set the environment variable PYTEST_DISABLE_PLUGIN_AUTOLOAD when calling pytest. Since disabling autoload is the "common path" for the project I'm working on, it would be very convenient to have a way to specify that in the configuration file.

Describe the solution you'd like

I can think of some solutions for this problem:

  1. Have a CLI option (e.g. --disable-plugin-autoload) with the same semantics as for setting PYTEST_DISABLE_PLUGIN_AUTOLOAD. That way, I can simply use that for the addopts property of the configuration;
  2. Have an option in the configuration for defining environment variables. Then I could set PYTEST_DISABLE_PLUGIN_AUTOLOAD there;
  3. Having a specific option in the configuration for disabling autoload.

Out of the three options above, I'm leaning more toward option (1) because (i) it would also allow disabling autoload from the command line without having to prefix the command with the env var assignment; and (ii) it does not require a new configuration option.

Best regards,
Gustavo Sousa

Activity

  1. added
    topic: configrelated to config handling, argument parsing and config file
    type: proposalproposal for a new feature, often to gather opinions or design the API around the new feature
    on Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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