test_order

import pytest
#pip install pytest-ordering
#pip install pytest-rerunfailures
#修改函数的执行顺序
#都是负数,值越小越先执行
#0和负数,0先执行
#0>较小整数>较大整数>无标记>较小负数>较大负数
@pytest.mark.run(order=3)
def test_a():
	print("
test_a")
	assert 1

@pytest.mark.run(order=1)
def test_b():
	print("
test_b")
	assert 0

@pytest.mark.run(order=2)
def test_hello():
	print("
hello_test")
	assert 1 

if __name__ == '__mian__':
	pytest.main("-s test_order.py")
原文地址:https://www.cnblogs.com/gerenboke/p/13617015.html