import pytest
@pytest.fixture()
def login_r():
print('登陆') @pytest.fixture()
def open_browser():
print('打开浏览器') def test_soso():
print('case3') @pytest.mark.usefixtures('login_r')----通过usefixtures可以让test_cart前置执行login
def test_cart():
print('case4') if __name__ == '__main__':
pytest.main()

pytest_twofixture.py::test_soso PASSED [ 50%]case3

pytest_twofixture.py::test_cart 登陆
PASSED [100%]case4

案例2

import pytest
@pytest.fixture()
def login_r(open_browser):
print('登陆') @pytest.fixture()
def open_browser():
print('打开浏览器') def test_soso():
print('case3') @pytest.mark.usefixtures('login_r')
def test_cart():
print('case4') if __name__ == '__main__':
pytest.main()

pytest_twofixture.py::test_soso PASSED [ 50%]case3

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

最新文章

  1. Javascript获取URL地址变量参数值的方法
  2. 屌炸天实战 MySQL 系列教程(二) 史上最屌、你不知道的数据库操作
  3. QML插件扩展2(基于C++的插件扩展)
  4. test命令
  5. .Net上传文件大小配置
  6. PHP5.6+7代码性能加速-开启Zend OPcache-优化CPU
  7. springMVC(6)---处理模型数据
  8. Docker笔记——jdk镜像制作
  9. (二)Javascript面向对象编程:构造函数的继承
  10. 基于vue2.0 +vuex+ element-ui后台管理系统:包括本地开发调试详细步骤
  11. Capture HTML Canvas as gif/jpg/png/pdf?
  12. 21 MRO C3算法
  13. Thinkphp路由使用
  14. hive中数据存储格式对比:textfile,parquent,orc,thrift,avro,protubuf
  15. svn问题汇总
  16. UVA12558 Egyptian Fractions (HARD version) (埃及分数,迭代加深搜索)
  17. python实现将json数据以json格式写入txt文件
  18. 题解【bzoj4587 & bzoj4408 [FJOI2016]神秘数】
  19. OpenGL 模型视图投影矩阵 仿射矩阵
  20. VS2010安装HTML5插件

热门文章

  1. NMS python实现
  2. 從nasm assembly看函數參數傳遞
  3. ArcGis 创建含孔洞面要素AO C#
  4. javafx将数据库内容输出到tableview表格
  5. json数据扁平化处理
  6. Recall,Precision,ROC曲线的介绍
  7. 笔记67 Spring Boot快速入门(七)
  8. 四大开源协议比较:BSD、Apache、GPL、LGPL(转)
  9. 阿里小程序Serverless 操作指南
  10. linux IPC的信号量