pytest--两个fixture时,灵活运用

import pytest
@pytest.fixture()
def login_r(open_browser):
print('登陆')

@pytest.fixture()
def open_browser():
print('打开浏览器')

def test_soso(open_browser):
print('case3')

# @pytest.mark.usefixtures('lgoin_r')
def test_cart(login_r):
print('case4')

if __name__ == '__main__':
pytest.main()

pytest_twofixture.py::test_soso 打开浏览器
PASSED [ 50%]case3

pytest_twofixture.py::test_cart 打开浏览器
登陆
PASSED [100%]case4

posted on 2019-09-21 22:58  barton123  阅读(179)  评论(0编辑  收藏  举报

导航