Skip to content

Commit a1b6fcb

Browse files
authored
github actions (via allure-framework#454)
1 parent 0e28e07 commit a1b6fcb

16 files changed

Lines changed: 98 additions & 48 deletions

File tree

.github/workflows/build.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: allure python
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
package: [
11+
allure-python-commons-test,
12+
allure-python-commons,
13+
allure-behave,
14+
allure-pytest,
15+
allure-pytest-bdd,
16+
allure-robotframework
17+
]
18+
python-version: [3.6, 3.7]
19+
include:
20+
- python-version: 3.7
21+
static-check: yes
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v1
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Install Tox
32+
run: pip install tox
33+
34+
- name: Static check ${{ matrix.package }}
35+
if: matrix.static-check
36+
run: tox -e static-check -c ${{ matrix.package }}/tox.ini
37+
38+
- name: Prepare commons
39+
if: "!startsWith(matrix.package, 'allure-python-commons')"
40+
run: tox --sdistonly -c ./allure-python-commons && tox --sdistonly -c ./allure-python-commons-test
41+
42+
- name: Test ${{ matrix.package }}
43+
run: tox -e py`echo ${{ matrix.python-version }} | sed 's/\.//g'` -c ${{ matrix.package }}/tox.ini

allure-behave/tox.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ setenv =
1010
TEST_TMP={envtmpdir}
1111
ALLURE_INDENT_OUTPUT=yep
1212

13-
whitelist_externals = rm
14-
1513
deps=
1614
{distshare}/allure-python-commons-2*.zip
1715
{distshare}/allure-python-commons-test-2*.zip
1816

19-
commands=
17+
whitelist_externals =
18+
rm
19+
20+
commands =
2021
rm -rf {envtmpdir}/*
2122
behave -f allure_behave.formatter:AllureFormatter -o {envtmpdir}/allrue-result -f pretty {posargs: ./features}
2223

@@ -88,9 +89,8 @@ commands =
8889
bash -c 'find {envtmpdir}/ -type f -exec cp -rfp \{\} {envtmpdir}/demo/ \;'
8990

9091

91-
[testenv:static_check]
92-
basepython = python3.7
93-
92+
[testenv:static-check]
93+
basepython = python
9494
skip_install = True
9595

9696
deps = flake8

allure-pytest-bdd/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ def main():
4343
install_requires=install_requires
4444
)
4545

46+
4647
if __name__ == '__main__':
4748
main()
48-

allure-pytest-bdd/src/pytest_bdd_listener.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import pytest
22
from allure_commons.utils import now
3-
from allure_commons.model2 import Label, Link
3+
from allure_commons.model2 import Label
44
from allure_commons.model2 import Status
55

6-
from allure_commons.types import LabelType, AttachmentType
6+
from allure_commons.types import LabelType
77
from allure_commons.utils import platform_label
88
from allure_commons.utils import host_tag, thread_tag
99
from .utils import get_uuid

allure-pytest-bdd/src/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def get_uuid(*args):
2121
def get_status_details(exception):
2222
message = str(exception)
2323
trace = format_exception(type(exception), exception)
24-
return StatusDetails(message=message, trace=trace) if message or trace else None
24+
return StatusDetails(message=message, trace=trace) if message or trace else None

allure-pytest-bdd/test/conftest.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import allure_commons
55
from allure_commons_test.report import AllureReport
66
from allure_commons.logger import AllureFileLogger
7-
from .pytest_bdd_steps import *
8-
from .report_steps import *
7+
from .pytest_bdd_steps import * # noqa F401 F403
8+
from .report_steps import * # noqa F401 F403
99

1010

1111
@contextmanager
@@ -41,4 +41,3 @@ def run_with_allure(self):
4141
@pytest.fixture
4242
def allured_testdir(testdir, request):
4343
return AlluredTestdir(testdir, request)
44-

allure-pytest-bdd/test/dummy_steps.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import pytest
22
from pytest_bdd import given, then, when
33

4+
45
@given('passed step1')
56
def given_passed_step1():
67
pass
78

9+
810
@given('passed step')
911
def given_passed_step():
1012
pass
@@ -36,21 +38,21 @@ def then_skipped_step():
3638

3739

3840
@given('failed step')
39-
def given_skipped_step():
41+
def given_failed_step():
4042
assert False
4143

4244

4345
@when('failed step')
44-
def when_skipped_step():
46+
def when_failed_step():
4547
assert False
4648

4749

4850
@then('failed step')
49-
def then_skipped_step():
51+
def then_failed_step():
5052
assert False
5153

5254

5355
@when('<status> step')
54-
def when_skipped_step():
56+
def when_sfailed_step():
5557
pass
5658
assert False

allure-pytest-bdd/test/pytest_bdd_steps.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pytest_bdd import given, when, then
1+
from pytest_bdd import given, when
22
from pytest_bdd import parsers
33

44

@@ -16,7 +16,6 @@ def dummy_steps(request, testdir):
1616
testdir.makeconftest(content)
1717

1818

19-
#@given(parsers.parse("test file with {scenario} scenario"))
2019
@given(parsers.parse('test file with "{scenario}" scenario in {feature}'))
2120
def test_file_with_scenario(testdir, scenario, feature):
2221
testdir.makepyfile(current_test="""
@@ -32,6 +31,3 @@ def test_it():
3231
@when("run pytest-bdd with allure")
3332
def run(allured_testdir):
3433
allured_testdir.run_with_allure()
35-
36-
37-

allure-pytest-bdd/test/report_steps.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from pytest_bdd import then
22
from pytest_bdd import parsers
3-
import pytest
43

54

65
@then(parsers.parse("it has result for {scenario} scenario"))

allure-pytest-bdd/tox.ini

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py{37}
3+
py{36,37}
44

55
[testenv]
66
passenv = HOME
@@ -18,4 +18,14 @@ commands =
1818
-s -v -p pytester \
1919
./test
2020
; -W ignore::pytest.PytestExperimentalApiWarning \
21-
; -p pytester {posargs: ./test/acceptance}
21+
; -p pytester {posargs: ./test/acceptance}
22+
23+
24+
[testenv:static-check]
25+
basepython = python
26+
skip_install = True
27+
deps = flake8
28+
commands = flake8 ./
29+
30+
[flake8]
31+
max-line-length = 120

0 commit comments

Comments
 (0)