# -*- coding: utf-8 -*-# @Time : 2022/3/23# @Author : 大海import os
deftest_1():
a =1+2assert a ==3deftest_2():
a =1+2assert a !=3deftest_3():
a =2+2assert a ==3deftest_4():
a =2+2assert a ==4if __name__ =='__main__':
os.system('pytest -s test_54.py')
–lf ,–last-failed :只重新运行上次运行失败的用例(或如果没有失败的话会全部跑)
# -*- coding: utf-8 -*-# @Time : 2022/3/23# @Author : 大海import os
deftest_1():
a =1+2assert a ==3deftest_2():
a =1+2assert a !=3deftest_3():
a =2+2assert a ==3deftest_4():
a =2+2assert a ==4if __name__ =='__main__':# 加上--lf 参数
os.system('pytest -s test_54.py --lf')
# -*- coding: utf-8 -*-# @Time : 2022/3/23# @Author : 大海import os
deftest_1():
a =1+2assert a ==3deftest_2():
a =1+2assert a !=3deftest_3():
a =2+2assert a ==3deftest_4():
a =2+2assert a ==4if __name__ =='__main__':
os.system('pytest -s test_54.py --ff')