将列表传递给pytest fixture并在没有循环的情况下迭代

时间:2017-09-16 06:15:07

标签: python

我正在尝试编写测试功能。

import pytest

@pytest.fixture(passed_list)
def test_search_through(last_state):
    # Here I want iteration through the passed_list as follows
    # last_state = passed_list[0], then last_state = passed_list[1], last_state = passed_list[2] etc. without loop
    # and depending on what will I get in last_state do some stuff
if last_state == .... :
    # .... do something
elif last_state == ....:
    # .... do something
elif last_state == ....:
    # .... do something

如何在这种情况下传递一个列表,是否有可能在没有循环的情况下遍历列表? 提前谢谢!

0 个答案:

没有答案