株式会社ヴァンデミックシステム

Blog

<スポンサーリンク>

@pytest.mark.skipを使う。

import pytest


@pytest.mark.skip(reason="まだできてない")
def test_hello():
    print("hello")


def test_world():
    print("world")

実行すると、SKIPPEDと出る。

➜  pytest1 pytest -v -s
============================================================================================= test session starts ==============================================================================================
platform darwin -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0 -- /opt/homebrew/opt/python@3.11/bin/python3.11
cachedir: .pytest_cache
rootdir: /Users/yuta/pytest/pytest1
plugins: mock-3.11.1
collected 3 items

test_sec2.py::test_hello hello
PASSED
test_sec2_2.py::test_hello SKIPPED (まだできてない)
test_sec2_2.py::test_world world
PASSED

========================================================================================= 2 passed, 1 skipped in 0.00s =========================================================================================

<スポンサーリンク>

コメントを残す

Allowed tags:  you may use these HTML tags and attributes: <a href="">, <strong>, <em>, <h1>, <h2>, <h3>
Please note:  all comments go through moderation.

*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)