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:
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 assetup_provider
)This ensures that whatever is currently hiding under the
provider
parameter will be set up.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
-containers_provider
- ...and othersIf these don’t really fit your needs, you can implement your own module-local
a_provider
fixture usingsetup_one_by_class_or_skip
or more adjustablesetup_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_or_skip
(request, filters=None, use_global_filters=True)[source]¶ Sets up one of matching providers or skips the test
Parameters: - 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
- filters – List of
-
fixtures.provider.
setup_or_skip
(request, provider)[source]¶ Sets up given provider or skips the test
Note
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_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