示例:
# -*- coding: utf-8 -*- ‘‘‘ 业务逻辑相同,输入参数量较大, 使用 pyetst内置装饰器@pytest.mark.parametrize(‘参数名‘,参数列表) ‘‘‘ import pytest @pytest.mark.parametrize(‘x,y‘,[(1,2),(3,4)]) def test_sum(x,y): sum = x+y print(‘\n‘) print(sum) if __name__ == ‘__main__‘: pytest.main([‘test_scripts02.py‘,‘-s‘])