Skip to content

Commit c9a1574

Browse files
committed
add test
1 parent 732b0f5 commit c9a1574

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

plugin_test.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
pytest_plugins = 'pytester'
2+
import pytest
3+
4+
def test_annotation_fail(testdir):
5+
testdir.makepyfile(
6+
'''
7+
import pytest
8+
pytest_plugins = 'pytest_github_actions_annotate_failures'
9+
10+
def test_fail():
11+
assert 0
12+
'''
13+
)
14+
result = testdir.runpytest()
15+
result.stdout.fnmatch_lines([
16+
'::error file=test_annotation_fail.py,line=4::def test_fail():%0A*',
17+
])
18+
19+
def test_annotation_exception(testdir):
20+
testdir.makepyfile(
21+
'''
22+
import pytest
23+
pytest_plugins = 'pytest_github_actions_annotate_failures'
24+
25+
def test_fail():
26+
raise Exception('oops')
27+
assert 1
28+
'''
29+
)
30+
result = testdir.runpytest()
31+
result.stdout.fnmatch_lines([
32+
'::error file=test_annotation_exception.py,line=4::def test_fail():%0A*',
33+
])

0 commit comments

Comments
 (0)