Skip to content

Commit 6048296

Browse files
committed
regression test for path resolution
1 parent 058b1be commit 6048296

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

plugin_test.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pytest_plugins = 'pytester'
22
import pytest
3+
import os
34
from packaging import version
45

56
# result.stdout.no_fnmatch_line() is added to testdir on pytest 5.3.0
@@ -73,3 +74,21 @@ def test_fail():
7374
testdir.monkeypatch.setenv('GITHUB_ACTIONS', '')
7475
result = testdir.runpytest_subprocess()
7576
no_fnmatch_line(result, '::error file=test_annotation_fail_disabled_outside_workflow.py')
77+
78+
def test_annotation_fail_cwd(testdir):
79+
testdir.makepyfile(
80+
'''
81+
import pytest
82+
pytest_plugins = 'pytest_github_actions_annotate_failures'
83+
84+
def test_fail():
85+
assert 0
86+
'''
87+
)
88+
testdir.monkeypatch.setenv('GITHUB_ACTIONS', 'true')
89+
testdir.mkdir('foo')
90+
testdir.makefile('.ini', pytest='[pytest]\ntestpaths=..')
91+
result = testdir.runpytest_subprocess('--rootdir=foo')
92+
result.stdout.fnmatch_lines([
93+
'::error file=test_annotation_fail_cwd.py,line=4::def test_fail():*',
94+
])

0 commit comments

Comments
 (0)