如何将参数发送到pytest\u runtest_

2024-04-19 14:16:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我的电脑里有以下内容确认测试.py文件

 def pytest_collection_modifyitems(config,items):
   with open("C:\Users\xyz\mno\cli_automation\test_configuration\project\test_command.yml", 'r') as stream:
       data_loaded = yaml.load(stream)
       for i in items:
           if i.name == data_loaded.get("test_name"):
               i.add_marker(data_loaded.get("test_type"))
               pytest_runtest_call(i)

我无法将加载的yaml配置详细信息发送到我的pytest\u runtest\u调用。我怎样才能做到呢?你知道吗


Tags: 文件namepytestyamldatastreamget