Как передать список данных в функцию тестирования с помощью Pytest? Каждый тестовый пример очень похож, за исключением этого входного параметра. Я пробовал следующее, но безрезультатно:
import pytest
@pytest.fixture
def List_of_Numbers():
list = [1,2,3,4,5,6,7,8]
@pytest.parametrize("number", [i for item in list])
def test_eval(number):
assert eval(number%2) == 0
pytest
выход:
==================================== ERRORS ====================================
_________________________ ERROR collecting sample4.py __________________________
sample4.py:8: in <module>
@pytest.parametrize("number", [i for item in list])
E AttributeError: module 'pytest' has no attribute 'parametrize'
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.30 seconds ============================