def pytest_generate_tests(metafunc): data = load_cfme_data(metafunc.config.option.cfme_data_filename) argnames = [] tests = [] if 'pwr_ctl_vms' in metafunc.fixturenames: argnames = ['pwr_ctl_vms', 'provider', 'vm_name'] metafunc.parametrize(argnames, fetch_list(data), scope="module") elif 'random_pwr_ctl_vm' in metafunc.fixturenames: argnames = ['random_pwr_ctl_vm', 'provider', 'vm_name'] all_tests = fetch_list(data) if all_tests: tests.append(random.choice(all_tests)) metafunc.parametrize(argnames, tests, scope="module")
def pytest_runtest_setup(item): # If cfme_data_filename is None, it will be autoloaded CfmeSetup.data = load_cfme_data(item.config.option.cfme_data_filename)