cfme.markers.env_markers.provider module

class cfme.markers.env_markers.provider.DPFilter(keys=None, classes=None, required_fields=None, required_tags=None, required_flags=None, restrict_version=False, inverted=False, conjunctive=True)[source]

Bases: cfme.utils.providers.ProviderFilter


Applies this filter on a given DataProvider


pf = ProviderFilter('cloud_infra', categories=['cloud', 'infra'])
providers = list_providers([pf])
pf2 = ProviderFilter(
    classes=[GCEProvider, EC2Provider], required_fields=['small_template'])
provider_keys = [prov.key for prov in list_providers([pf, pf2])]
^ this will list keys of all GCE and EC2 providers
pf = ProviderFilter(required_tags=['openstack', 'complete'])
pf_inverted = ProviderFilter(required_tags=['disabled'], inverted=True)
providers = list_providers([pf, pf_inverted])
^ this will return providers that have both the "openstack" and "complete" tags set
  and at the same time don't have the "disabled" tag
pf = ProviderFilter(keys=['rhevm34'], class=CloudProvider, conjunctive=False)
providers = list_providers([pf])
^ this will list all providers that either have the 'rhevm34' key or are an instance
  of the CloudProvider class and therefore are a cloud provider
Returns:True if provider passed all checks and was not filtered out, False otherwise. The result is opposite if the ‘inverted’ attribute is set to True.
class cfme.markers.env_markers.provider.DataProvider(category, type_name, version, klass=NOTHING)[source]

Bases: object

A simple holder for a pseudo provider.

This is not a real provider. This is used in place of a real provider to allow things like uncollections to take place in the case that we do not actually have an environment set up for this particular provider.


Automatically created by attrs.


Automatically created by attrs.


Automatically created by attrs.


Automatically created by attrs.


Check equality and either forward a NotImplemented or return the result negated.


Automatically created by attrs.

class cfme.markers.env_markers.provider.ProviderEnvironmentMarker[source]

Bases: cfme.markers.env.EnvironmentMarker

NAME = 'provider'
cfme.markers.env_markers.provider.all_required(miq_version, filters=None)[source]

This returns a list DataProvider objects

This list of providers is a representative of the providers that a test should be run against.

  • miq_version – The version of miq to query the supportability
  • filters – A list of filters
cfme.markers.env_markers.provider.parametrize(metafunc, argnames, argvalues, *args, **kwargs)[source]

parametrize wrapper that calls _param_check(), and only parametrizes when needed

This can be used in any place where conditional parametrization is used.

cfme.markers.env_markers.provider.providers(metafunc, filters=None, selector='all')[source]

Gets providers based on given (+ global) filters


Using the default ‘function’ scope, each test will be run individually for each provider before moving on to the next test. To group all tests related to single provider together, parametrize tests in the ‘module’ scope.


testgen for providers now requires the usage of test_flags for collection to work. Please visit for more details.

cfme.markers.env_markers.provider.providers_by_class(metafunc, classes, required_fields=None, selector='all')[source]

Gets providers by their class

  • metafunc – Passed in by pytest
  • classes – List of classes to fetch
  • required_fields – See cfme.utils.provider.ProviderFilter


# In the function itself
def pytest_generate_tests(metafunc):
    argnames, argvalues, idlist = testgen.providers_by_class(
        [GCEProvider, AzureProvider], required_fields=['provisioning']
metafunc.parametrize(argnames, argvalues, ids=idlist, scope='module')

# Using the parametrize wrapper
pytest_generate_tests = testgen.parametrize([GCEProvider], scope='module')