Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,31 @@ def test_param(a, b):
)


@pytest.mark.skipif(
version.parse("9.0.0") > PYTEST_VERSION,
reason="subtests are only supported in pytest 9+",
)
def test_annotation_subtest(testdir: pytest.Testdir):
testdir.makepyfile(
"""
import pytest
pytest_plugins = 'pytest_github_actions_annotate_failures'

def test(subtests):
for i in range(5):
with subtests.test(msg="custom message", i=i):
assert i % 2 == 0
"""
)
testdir.monkeypatch.setenv("GITHUB_ACTIONS", "true")
result = testdir.runpytest_subprocess()
result.stderr.fnmatch_lines(
[
"::error file=test_annotation_subtest.py,line=7::test?custom message?0*assert 1 == 0*",
]
)


# Debugging / development tip:
# Add a breakpoint() to the place you are going to check,
# uncomment this example, and run it with:
Expand Down
Loading