pytestini配置如下addopts = -vs --reruns 1 --reruns-delay 1 --only-rerun NoWaveFileError -p nowarnings --color yes --continue-on-collection-errors想把它写在pytestmain函数的参数里应该怎么写?
可以这样写:
pytest.main(['-vs', '--reruns', '1', '--reruns-delay', '1', '--only-rerun', 'NoWaveFileError', '-p', 'no:warnings', '--color', 'yes', '--continue-on-collection-errors'])
其中,pytest.main()函数的参数是一个列表,列表中的每个元素都是一个命令行参数。需要注意的是,命令行参数之间要用逗号隔开,而不是空格。
原文地址: https://www.cveoy.top/t/topic/friY 著作权归作者所有。请勿转载和采集!