File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,31 @@ def test_param(a, b):
327327 )
328328
329329
330+ @pytest .mark .skipif (
331+ version .parse ("9.0.0" ) > PYTEST_VERSION ,
332+ reason = "subtests are only supported in pytest 9+" ,
333+ )
334+ def test_annotation_subtest (testdir : pytest .Testdir ):
335+ testdir .makepyfile (
336+ """
337+ import pytest
338+ pytest_plugins = 'pytest_github_actions_annotate_failures'
339+
340+ def test(subtests):
341+ for i in range(5):
342+ with subtests.test(msg="custom message", i=i):
343+ assert i % 2 == 0
344+ """
345+ )
346+ testdir .monkeypatch .setenv ("GITHUB_ACTIONS" , "true" )
347+ result = testdir .runpytest_subprocess ()
348+ result .stderr .fnmatch_lines (
349+ [
350+ "::error file=test_annotation_subtest.py,line=7::test?custom message?0*assert 1 == 0*" ,
351+ ]
352+ )
353+
354+
330355# Debugging / development tip:
331356# Add a breakpoint() to the place you are going to check,
332357# uncomment this example, and run it with:
You can’t perform that action at this time.
0 commit comments