File tree Expand file tree Collapse file tree 2 files changed +83
-0
lines changed Expand file tree Collapse file tree 2 files changed +83
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : test
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+ pull_request :
8
+
9
+ jobs :
10
+ test :
11
+ runs-on : ubuntu-latest
12
+
13
+ strategy :
14
+ matrix :
15
+ python-version : [3.5, 3.6, 3.7, 3.8]
16
+
17
+ steps :
18
+ - uses : actions/checkout@v2
19
+
20
+ - name : Set up Python ${{ matrix.python-version }}
21
+ uses : actions/setup-python@v1
22
+ with :
23
+ python-version : ${{ matrix.python-version }}
24
+
25
+ - name : Install dependencies
26
+ run : |
27
+ python -m pip install --upgrade pip
28
+ pip install -r requirements.txt
29
+
30
+ - name : Install itself
31
+ run : python setup.py install
32
+
33
+ - run : pytest
34
+ env :
35
+ PYTEST_PLUGINS : pytest_github_actions_annotate_failures
Original file line number Diff line number Diff line change
1
+ pytest_plugins = 'pytester'
2
+ import pytest
3
+
4
+ def test_annotation_succeed_no_output (testdir ):
5
+ testdir .makepyfile (
6
+ '''
7
+ import pytest
8
+ pytest_plugins = 'pytest_github_actions_annotate_failures'
9
+
10
+ def test_success():
11
+ assert 1
12
+ '''
13
+ )
14
+ result = testdir .runpytest ()
15
+ result .stdout .no_fnmatch_line (
16
+ '::error file=test_annotation_succeed_no_output.py*' ,
17
+ )
18
+
19
+ def test_annotation_fail (testdir ):
20
+ testdir .makepyfile (
21
+ '''
22
+ import pytest
23
+ pytest_plugins = 'pytest_github_actions_annotate_failures'
24
+
25
+ def test_fail():
26
+ assert 0
27
+ '''
28
+ )
29
+ result = testdir .runpytest ()
30
+ result .stdout .fnmatch_lines ([
31
+ '::error file=test_annotation_fail.py,line=4::def test_fail():%0A*' ,
32
+ ])
33
+
34
+ def test_annotation_exception (testdir ):
35
+ testdir .makepyfile (
36
+ '''
37
+ import pytest
38
+ pytest_plugins = 'pytest_github_actions_annotate_failures'
39
+
40
+ def test_fail():
41
+ raise Exception('oops')
42
+ assert 1
43
+ '''
44
+ )
45
+ result = testdir .runpytest ()
46
+ result .stdout .fnmatch_lines ([
47
+ '::error file=test_annotation_exception.py,line=4::def test_fail():%0A*' ,
48
+ ])
You can’t perform that action at this time.
0 commit comments