Skip to content

Commit 81f57a4

Browse files
committed
tests: address review points from @utgwkk
1 parent 132b3d0 commit 81f57a4

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

plugin_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test_fail():
119119
testdir.monkeypatch.setenv('GITHUB_ACTIONS', 'true')
120120
result = testdir.runpytest_subprocess()
121121
result.stdout.fnmatch_lines([
122-
'::error file=test_annotation_long.py,line=17::test_annotation_fail*assert 8 == 3*where 8 = f(8)*',
122+
'::error file=test_annotation_long.py,line=17::test_fail*assert 8 == 3*where 8 = f(8)*',
123123
])
124124
no_fnmatch_line(result, '::*assert x += 1*')
125125

@@ -145,7 +145,7 @@ def test_method(self):
145145

146146

147147

148-
def test_annotation_long(testdir):
148+
def test_annotation_param(testdir):
149149
testdir.makepyfile(
150150
'''
151151
import pytest
@@ -164,7 +164,7 @@ def test_param(a, b):
164164
testdir.monkeypatch.setenv('GITHUB_ACTIONS', 'true')
165165
result = testdir.runpytest_subprocess()
166166
result.stdout.fnmatch_lines([
167-
'::error file=test_annotation_long.py,line=11::test_param?other?1*assert 2 == 3*',
167+
'::error file=test_annotation_param.py,line=11::test_param?other?1*assert 2 == 3*',
168168
])
169169

170170
# Debugging / development tip:

pytest_github_actions_annotate_failures/plugin.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
import pytest
44
from collections import OrderedDict
55

6+
# Reference:
7+
# https://docs.pytest.org/en/latest/writing_plugins.html#hookwrapper-executing-around-other-hooks
8+
# https://docs.pytest.org/en/latest/writing_plugins.html#hook-function-ordering-call-example
9+
# https://docs.pytest.org/en/stable/reference.html#pytest.hookspec.pytest_runtest_makereport
10+
#
11+
# Inspired by:
12+
# https://github.com/pytest-dev/pytest/blob/master/src/_pytest/terminal.py
13+
614
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
715
def pytest_runtest_makereport(item, call):
816
# execute all other hooks to obtain the report object

0 commit comments

Comments
 (0)