Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
diff --git a/utils/ b/utils/
index 096410d..c794b29 100644
--- a/utils/
+++ b/utils/
@@ -222,7 +222,7 @@ def provider_by_type(metafunc, provider_types, *fields, **options):
idlist = []
special_args = ('provider_key', 'provider_data', 'provider_crud',
- 'provider_mgmt', 'provider_type')
+ 'provider_mgmt', 'provider_type', 'provider_setup')
# Hook on special attrs if requested
for argname in special_args:
if argname in metafunc.fixturenames and argname not in argnames:
@@ -270,11 +270,20 @@ def provider_by_type(metafunc, provider_types, *fields, **options):
mgmt = provider_factory(provider)
+ def provider_setup():
+'the fixture ran!')
+ return 'provider_setup'
+ provider_setup = pytest.fixture()(provider_setup)
values = []
- special_args_map = dict(zip(special_args, (provider, data, crud, mgmt, prov_type)))
+ special_args_map = dict(zip(special_args, (provider, data, crud, mgmt, prov_type,
+ provider_setup)))
for arg in argnames:
if arg in special_args_map:
+ if arg == 'provider_setup':
+ metafunc.fixturenames.append(arg)
+ print metafunc.fixturenames
elif arg in data_values:
import pytest
from utils import testgen
pytest_generate_tests = testgen.generate(testgen.infra_providers)
# def pytest_generate_tests(metafunc):
# ret = testgen.infra_providers(metafunc)
# print ret
# return ret
def fixture():
def test_gen(provider_setup):
print 'provider setup', provider_setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment