pytest跳过测试skip

import pytest

class TestClass:
    @pytest.mark.skip(reason="跳过")
    def test_one(self):
        assert True

    @pytest.mark.skipif(True,reason="跳过")
    def test_two(self):
        assert False

    def test_three(self):
        assert True

 

直接运行看不到跳过原因,这时候可以使用 -rs

pytest -rs test_demo4.py

==== test session starts ====
collected 3 items

test_demo4.py ss. [100%]
=== short test summary info ===
SKIPPED [1] test_demo4.py:9: 跳过
SKIPPED [1] test_demo4.py:4: 跳过

=== 1 passed, 2 skipped in 0.07 seconds ===

posted @ 2019-07-05 17:50  OTAKU_nicole  阅读(1165)  评论(0编辑  收藏  举报