| 1 |
import textwrap |
| 2 |
import pytest |
| 3 |
|
| 4 |
pytest_plugins = "pytester" |
| 5 |
|
| 6 |
|
| 7 |
@pytest.fixture(name="emoji_tests") |
| 8 |
def fixture_emoji_tests(): |
| 9 |
return textwrap.dedent( |
| 10 |
"""\ |
| 11 |
import pytest |
| 12 |
|
| 13 |
def test_passed(): |
| 14 |
assert "emoji" == "emoji" |
| 15 |
|
| 16 |
def test_failed(): |
| 17 |
assert "emoji" == "hello world" |
| 18 |
|
| 19 |
@pytest.mark.xfail |
| 20 |
def test_xfailed(): |
| 21 |
assert 1234 == 100 |
| 22 |
|
| 23 |
@pytest.mark.xfail |
| 24 |
def test_xpassed(): |
| 25 |
assert 1234 == 1234 |
| 26 |
|
| 27 |
@pytest.mark.skipif(True, reason="don't run this test") |
| 28 |
def test_skipped(): |
| 29 |
assert "emoji" == "emoji" |
| 30 |
|
| 31 |
@pytest.fixture |
| 32 |
def name(): |
| 33 |
raise RuntimeError |
| 34 |
|
| 35 |
@pytest.mark.hello |
| 36 |
def test_error(name): |
| 37 |
assert name == "hello" |
| 38 |
""" |
| 39 |
) |
| 40 |
|
| 41 |
|
| 42 |
@pytest.fixture(name="custom_emojis") |
| 43 |
def fixture_custom_emojis(): |
| 44 |
return textwrap.dedent( |
| 45 |
"""\ |
| 46 |
def pytest_emoji_passed(config): |
| 47 |
return "🍪 ", "PASSED 🍪 " |
| 48 |
|
| 49 |
|
| 50 |
def pytest_emoji_failed(config): |
| 51 |
return "😿 ", "FAILED 😿 " |
| 52 |
|
| 53 |
|
| 54 |
def pytest_emoji_skipped(config): |
| 55 |
return "🙈 ", "SKIPPED 🙈 " |
| 56 |
|
| 57 |
|
| 58 |
def pytest_emoji_error(config): |
| 59 |
return "💩 ", "ERROR 💩 " |
| 60 |
|
| 61 |
|
| 62 |
def pytest_emoji_xfailed(config): |
| 63 |
return "🤓 ", "XFAIL 🤓 " |
| 64 |
|
| 65 |
|
| 66 |
def pytest_emoji_xpassed(config): |
| 67 |
return "😜 ", "XPASS 😜 " |
| 68 |
""" |
| 69 |
) |