pytest使用fixture參數化

import pytest

#parametrize參數化
@pytest.mark.parametrize("A", [1, 2, 3, 4, 5])
def test_A(A):
    assert A > 3


#fixture參數化
B = [1, 2, 3, 4, 5]
ids = ['a','b','c','d','e']

@pytest.fixture(params=B,ids=ids)
def get_B():
    return B

def test_B(get_B):
    assert get_B>3
相關文章
相關標籤/搜索