Pytest @pytest.mark.parametrize装饰器
作者:互联网
示例:
# -*- 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'])
标签:__,parametrize,sum,pytest,mark,Pytest,test 来源: https://www.cnblogs.com/Avicii2018/p/15207852.html