我有一个读取yaml文件并生成测试迭代的函数,该字典如下面的字典列表所示:
Iterations = lib_iterations()
print Iterations
Iterations = [{'mode':1,'format':5,'ip':'192.16.1.103'},
{'mode':2,'format':6,'ip':'192.16.1.104'},
{'mode':2,'format':8,'ip':'192.16.1.110'},
{'mode':6,'format':2,'ip':'192.16.1.105'},
{'mode':5,'format':7,'ip':'192.16.1.102'},
{'mode':4,'format':2,'ip':'192.16.1.101'}]
Run Code Online (Sandbox Code Playgroud)
我需要能够将此设置传递给pytest.mark.parametrize才能为列表中的每个迭代/每行生成一个测试。
在调用函数lib_iterations之前,我不知道字典键,该函数生成此字典列表。
有关如何执行此操作的任何想法?
谢谢AB
pytest ×1