From cf79f73d138238944b7284126be7df2b06b9147e Mon Sep 17 00:00:00 2001 From: Volodymyr Yahello Date: Sun, 10 Oct 2021 09:03:55 +0300 Subject: [PATCH] Cover skipped result with emoji [Problem] No skipped option [Solution] Skipped option is added --- plugin/emoji.py | 8 ++++++++ tests/test_emoji.py | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugin/emoji.py b/plugin/emoji.py index 1221b32..9aca12b 100644 --- a/plugin/emoji.py +++ b/plugin/emoji.py @@ -13,6 +13,7 @@ class _Emoji(Enum): HOLY: str = "😇" HELLISH: str = "😡" + SILENT: str = "😶" def __str__(self) -> str: """Returns emoji string value.""" @@ -80,3 +81,10 @@ def pytest_report_teststatus( # type: ignore long=f"{_Emoji.HELLISH} Oh crap, it is failed", ) return failed.outcome, failed.short, failed.long + if report.skipped: + skipped: _TestStatus = _TestStatus( + outcome=report.outcome, + short=str(_Emoji.SILENT), + long=f"{_Emoji.SILENT} Nevermind, it is skipped", + ) + return skipped.outcome, skipped.short, skipped.long diff --git a/tests/test_emoji.py b/tests/test_emoji.py index 959624b..ff1aa0b 100644 --- a/tests/test_emoji.py +++ b/tests/test_emoji.py @@ -36,5 +36,9 @@ def test_set_long(status: _TestStatus) -> None: def test_emoji() -> None: - for emoji, icon in {_Emoji.HOLY: '😇', _Emoji.HELLISH: '😡'}.items(): + for emoji, icon in { + _Emoji.HOLY: "😇", + _Emoji.HELLISH: "😡", + _Emoji.SILENT: "😶", + }.items(): assert str(emoji) == icon