fixtures.provider module

Fixtures to set up providers

Used to ensure that we have a provider set up on the appliance before running a test.

There are two ways to request a setup provider depending on what kind of test we create:

  1. Test parametrized by provider (test is run once per each matching provider) For parametrized tests, provider is delivered by testgen. Testgen ensures that the requested provider is available as the provider parameter. It doesn’t set the provider up, however, as it will only provide you with the appropriate provider CRUD object. To get the provider set up, we need to add one of the following fixtures to parameters as well: - setup_provider - setup_provider_modscope - setup_provider_clsscope - setup_provider_funcscope (same as setup_provider)

    This ensures that whatever is currently hiding under the provider parameter will be set up.

  2. Test not parametrized by provider (test is run once and we just need some provider available) In this case, we don’t really care about what sort of a provider we have available. Usually, we just want something to fill the UI with data so that we can test our provider non-specific functionality. For that, we can leverage one of the following fixtures: - infra_provider - cloud_provider - middleware_provider - containers_provider - ...and others

    If these don’t really fit your needs, you can implement your own module-local a_provider fixture using setup_one_by_class_or_skip or more adjustable setup_one_or_skip. These functions do exactly what their names suggest - they setup one of the providers fitting given parameters or skip the test. All of these fixtures are (and should be) function scoped. Please keep that in mind when creating your module-local substitutes.

If setting up a provider fails, the issue is logged and an internal counter is incremented as a result. If this counter reaches a predefined number of failures (see SETUP_FAIL_LIMIT), the failing provider will be added to the list of problematic providers and no further attempts to set it up will be made.

fixtures.provider.setup_one_by_class_or_skip(request, prov_class, use_global_filters=True)[source]
fixtures.provider.setup_one_or_skip(request, filters=None, use_global_filters=True)[source]

Sets up one of matching providers or skips the test

  • filters – List of ProviderFilter or None
  • request – Needed for logging a potential skip correctly in artifactor
  • use_global_filters – Will apply global filters as well if True, will not otherwise
fixtures.provider.setup_only_one_provider(request, has_no_providers)[source]
fixtures.provider.setup_or_skip(request, provider)[source]

Sets up given provider or skips the test


If a provider fails to setup SETUP_FAIL_LIMIT times, it will be added to the list of problematic providers and won’t be used by any test until the end of the test run.

fixtures.provider.setup_perf_provider(request, use_global_filters=True)[source]
fixtures.provider.setup_provider(request, provider)[source]

Function-scoped fixture to set up a provider

fixtures.provider.setup_provider_clsscope(request, provider)[source]

Module-scoped fixture to set up a provider

fixtures.provider.setup_provider_funcscope(request, provider)[source]

Function-scoped fixture to set up a provider

fixtures.provider.setup_provider_modscope(request, provider)[source]

Module-scoped fixture to set up a provider

fixtures.provider.template(template_location, provider)[source]