pytest.mark.run(order=**) ---测试用例的执行顺序

import pytest

@pytest.mark.run(order=-2)
def test_01():
    a = 1
    b = 2
    c = 3
    assert a<b
@pytest.mark.run(order=-1)
def test_02():
    a = 1
    b = 2
    c = 3
    assert a>b
@pytest.mark.run(order=3)
def test_03():
    a = 1
    b = 2
    c = 3
    assert a==b
@pytest.mark.run(order=4)
def test_04():
    a = 1
    b = 2
    c = 3
    assert a<c
if __name__ == '__main__':
    pytest.main(["-vs","test.py"])
# 注意:按照num排序时,正整数在前,负数在后面,然后统一按照从小到大的顺序执行。
F:\测试\python\Python36\python.exe F:/测试/pycharm-project/myproject/test.py
============================= test session starts =============================
platform win32 -- Python 3.6.0, pytest-7.0.1, pluggy-1.0.0 -- F:\测试\python\Python36\python.exe
cachedir: .pytest_cache
rootdir: F:\测试\pycharm-project\myproject
plugins: ordering-0.6
collecting ... collected 4 items

test.py::test_03 FAILED
test.py::test_04 PASSED
test.py::test_01 PASSED
test.py::test_02 FAILED
注意:按照num排序时,正整数在前,负数在后面,然后统一按照从小到大的顺序执行。
  • 10
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值