• Pytest多进程与多线程


    一、parallel
    1、安装
    pip install pytest-parallel 
    2、操作命令
    –workers (optional)  *:多进程运行需要加此参数,  *是进程数。默认为1。
    –tests-per-worker (optional)  *:多线程运行, *是每个worker运行的最大并发线程数。默认为1
    使用示例:
    pytest test.py –workers 3:3个进程运行
    pytest test.py –tests-per-worker 4:4个线程运行
    pytest test.py –workers 2 –tests-per-worker 4:2个进程并行,且每个进程最多4个线程运行,即总共最多8个线程运行。
    参考:https://pypi.org/project/pytest-parallel/
    3、注意点:
    ①需要使用
    if __name__ == '__main__':
    ②执行时间是运行时间最长的线程的时间。 
    ③目前存在一个bug,不能和allure报告使用,会组织xml文件生成。只能希望作者尽快修复了
    4、命令 pytest.main(["-v","-m","register","--alluredir=../../OutPuts/allure-results",'--workers=1','--tests-per-worker=4']) os.system(r"allure generate --clean ../../OutPuts/allure-results -o ../../allure-report ") 5、
  • 相关阅读:
    Unix/Linux笔记全集
    深入浅出-变长参数
    基于 SSH 的远程操作以及安全,快捷的数据传输<转>
    面向对象的特性—— 封装
    wpf 窗体翻页效果
    wpf控件拖动
    Wpf 导出CSV文件
    wpf 导出Excel
    Wpf Button 样式
    wpf简单进度条
  • 原文地址:https://www.cnblogs.com/minghong/p/12125029.html
Copyright © 2020-2023  润新知