pytest1-@pytest.fixture request参数化fixture

  • Post author:
  • Post category:其他

 

import pytest


# mark标记 带参数的fixture 中的某些参数枚举值
@pytest.fixture(params=[1, 2, pytest.param(3, marks=pytest.mark.skip)])
def data(request):
    return request.param

# 调用data
def test_data(data):
    pass


if __name__ == '__main__':
    pytest.main(['-vs', 'test_fixture_marks.py'])

版权声明:本文为xuyubotest原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。