【Python_pytest】pytest-parallel 多线程
安装
pip install pytest-parallel
常用参数配置:
- --workers=n:多进程运行需要加此参数, n是进程数。默认为1
- --tests-per-worker=n:多线程需要添加此参数,n是线程数
# 3个进程运行 pytest test.py --workers 3 # 4个线程运行 pytest test.py --tests-per-worker 4 # 2个进程并行,且每个进程最多4个线程运行,即总共最多8个线程运行。 pytest test.py --workers 2 --tests-per-worker 4
<Tips: 多进程并发在linux或者mac上做,在Windows上不起作用(Workers=1)
多线程linux/mac/windows平台都支持,进程数为workers的值。>
-------------------------------------------------------------------------------------
如果万事开头难 那请结局一定圆满 @ Phoenixy
-------------------------------------------------------------------------------------
浙公网安备 33010602011771号