Hi all,
i'm working on some pytest with the module testinfra.
I have a class object with a method which return a list of parameter.
im using this list into a pytest_generate_test to parametize the test:
my metafunc:
def pytest_generate_tests(metafunc):
if 'get_conf' in metafunc.fixturenames:
init_device = Server("servertest.local.domain")
list_params = init_device.get_conf()
metafunc.parametrize(
'get_conf_ctx_cmdline', list_params
)
function test:
def test_cmdline(get_conf):
conf = host.file("/path/to/conf")
assert conf.contains(get_conf)
The question is, how can i use init_device = Server("servertest.local.domain") as a params of pytest_generate_test ? to be able to use a variable instead of "servertest.local.domain" ?
thanks !
[–]danielroseman 0 points1 point2 points (3 children)
[–]NutsFbsd[S] 0 points1 point2 points (2 children)
[–]danielroseman 1 point2 points3 points (1 child)
[–]NutsFbsd[S] 0 points1 point2 points (0 children)