Skip to content

Commit 2d1fd85

Browse files
authored
can work with behave from master branch (aka 1.2.6) now (via allure-framework#164)
1 parent ad5b224 commit 2d1fd85

File tree

7 files changed

+64
-48
lines changed

7 files changed

+64
-48
lines changed

allure-behave/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
]
1414

1515
install_requires = [
16-
"behave==1.2.5",
16+
"behave>=1.2.5",
1717
"allure-python-commons==2.2.3b1"
1818
]
1919

allure-behave/src/listener.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from allure_commons.model2 import TestStepResult
1212
from allure_commons.model2 import TestBeforeResult, TestAfterResult
1313
from allure_commons.model2 import TestResultContainer
14-
from allure_commons.model2 import Status, Parameter, Label
14+
from allure_commons.model2 import Parameter, Label
1515
from allure_behave.utils import scenario_parameters
1616
from allure_behave.utils import scenario_severity
1717
from allure_behave.utils import scenario_tags
@@ -23,7 +23,6 @@
2323
from allure_behave.utils import get_status, get_status_details
2424

2525

26-
2726
BEFORE_FIXTURES = ['before_all', 'before_tag', 'before_feature', 'before_scenario']
2827
AFTER_FIXTURES = ['after_all', 'after_tag', 'after_feature', 'after_scenario']
2928
FIXTURES = BEFORE_FIXTURES + AFTER_FIXTURES
@@ -162,7 +161,6 @@ def stop_step(self, uuid, exc_type, exc_val, exc_tb):
162161
status=get_status(exc_val),
163162
statusDetails=get_status_details(exc_type, exc_val, exc_tb))
164163

165-
166164
@allure_commons.hookimpl
167165
def attach_data(self, body, name, attachment_type, extension):
168166
self.logger.attach_data(uuid4(), body, name=name, attachment_type=attachment_type, extension=extension)
@@ -185,4 +183,3 @@ def enter(self, _list=list()):
185183
def exit(self):
186184
gone, self[:] = self[:], self._stack.pop()
187185
return gone
188-

allure-behave/src/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import unicode_literals
33

4+
from enum import Enum
45
from behave.model import ScenarioOutline
56
from behave.runner_util import make_undefined_step_snippet
67
from allure_commons.types import Severity
7-
from allure_commons.model2 import Status, Parameter, Label
8+
from allure_commons.model2 import Status, Parameter
89
from allure_commons.model2 import StatusDetails
910
from allure_commons.utils import md5
1011
from allure_commons.utils import format_exception, format_traceback
@@ -74,7 +75,10 @@ def step_status(result):
7475
if result.exception:
7576
return get_status(result.exception)
7677
else:
77-
return STATUS.get(result.status, None)
78+
if isinstance(result.status, Enum):
79+
return STATUS.get(result.status.name, None)
80+
else:
81+
return STATUS.get(result.status, None)
7882

7983

8084
def get_status(exception):

allure-behave/tox.ini

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
[tox]
2-
envlist=
2+
envlist =
33
py{27,33,34,35}
44
static_check
55

66
[testenv]
7-
passenv =
8-
HOME
7+
passenv = HOME
98

109
setenv =
1110
TEST_TMP={envtmpdir}
1211
ALLURE_INDENT_OUTPUT=yep
1312

13+
whitelist_externals = rm
14+
15+
deps=
16+
{distshare}/allure-python-commons-2*.zip
17+
{distshare}/allure-python-commons-test-2*.zip
18+
19+
commands=
20+
rm -rf {envtmpdir}/*
21+
behave -f allure_behave.formatter:AllureFormatter -o {envtmpdir}/allrue-result -f pretty {posargs: ./features}
22+
23+
24+
[testenv:behave-master]
25+
passenv = HOME
26+
27+
basepython = python3.5
28+
29+
setenv =
30+
TEST_TMP={envtmpdir}
31+
ALLURE_INDENT_OUTPUT=yep
1432

1533
whitelist_externals = rm
1634

@@ -19,14 +37,14 @@ deps=
1937
{distshare}/allure-python-commons-test-2*.zip
2038

2139
commands=
22-
python setup.py develop
40+
pip uninstall -y behave
41+
pip install git+git://github.com/behave/behave.git
2342
rm -rf {envtmpdir}/*
2443
behave -f allure_behave.formatter:AllureFormatter -o {envtmpdir}/allrue-result -f pretty {posargs: ./features}
2544

2645

2746
[testenv:demo]
28-
passenv =
29-
HOME
47+
passenv = HOME
3048

3149
setenv =
3250
ALLURE_INDENT_OUTPUT=yep
@@ -37,9 +55,18 @@ whitelist_externals =
3755
mkdir
3856
bash
3957

40-
commands=
41-
python setup.py develop
58+
commands =
4259
rm -rf {envtmpdir}/*
4360
- behave -v {posargs: ./features}
4461
mkdir {envtmpdir}/demo
45-
bash -c 'find {envtmpdir}/ -type f -exec cp -rfp \{\} {envtmpdir}/demo/ \;'
62+
bash -c 'find {envtmpdir}/ -type f -exec cp -rfp \{\} {envtmpdir}/demo/ \;'
63+
64+
65+
[testenv:static_check]
66+
deps = flake8
67+
68+
commands = flake8 src/
69+
70+
71+
[flake8]
72+
max-line-length = 120

allure-pytest/tox.ini

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,39 @@
11
[tox]
2-
envlist=
2+
envlist =
33
py{27,33,34,35}
44
xdist
55
static_check
66

77

88
[testenv]
9-
passenv =
10-
HOME
9+
passenv = HOME
1110

1211
whitelist_externals = rm
1312

14-
deps=
13+
deps =
1514
pyhamcrest
1615
{distshare}/allure-python-commons-2*.zip
1716
{distshare}/allure-python-commons-test-2*.zip
1817

19-
commands=
20-
python setup.py develop
18+
commands =
2119
rm -f {envtmpdir}/*.json
2220
py.test --doctest-module --alluredir={envtmpdir} {posargs: ./test/}
2321

2422

2523
[testenv:xdist]
26-
passenv =
27-
HOME
24+
passenv = HOME
25+
26+
basepython = python3.5
2827

2928
whitelist_externals = rm
3029

31-
deps=
30+
deps =
3231
pyhamcrest
3332
pytest-xdist
3433
{distshare}/allure-python-commons-2*.zip
3534
{distshare}/allure-python-commons-test-2*.zip
3635

37-
commands=
38-
python setup.py develop
36+
commands =
3937
rm -f {envtmpdir}/*.json
4038
py.test -n 4 --doctest-module --alluredir={envtmpdir} {posargs: ./test/}
4139

@@ -46,27 +44,22 @@ commands=
4644
# `tox -e demo -- -k test_single_feature_label` or
4745
# `tox -e demo -- ./test/steps/`
4846
[testenv:demo]
49-
passenv =
50-
HOME
47+
passenv = HOME
5148

5249
whitelist_externals = rm
5350

54-
setenv =
55-
ALLURE_INDENT_OUTPUT=yep
51+
setenv = ALLURE_INDENT_OUTPUT=yep
5652

5753
commands=
58-
python setup.py develop
5954
rm -f {envtmpdir}/*.json
6055
- py.test -v --alluredir={envtmpdir} {posargs: ./test/}
6156

6257

6358
[testenv:static_check]
64-
deps=
65-
flake8
59+
deps = flake8
6660

67-
commands=
68-
flake8 src/
61+
commands = flake8 src/
6962

7063

7164
[flake8]
72-
max-line-length=120
65+
max-line-length = 120

allure-python-commons-test/tox.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
[tox]
2-
envlist=
3-
py{27,33,34,35}
2+
envlist = py{27,33,34,35}
43

54

65
[testenv]
7-
passenv =
8-
HOME
6+
passenv = HOME
97

108
commands=
119
python setup.py develop

allure-python-commons/tox.ini

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ envlist=
55

66

77
[testenv]
8-
passenv =
9-
HOME
8+
passenv = HOME
109

1110
deps=
1211
pytest
@@ -18,12 +17,10 @@ commands=
1817

1918

2019
[testenv:static_check]
21-
deps=
22-
flake8
20+
deps = flake8
2321

24-
commands=
25-
flake8 src/
22+
commands = flake8 src/
2623

2724

2825
[flake8]
29-
max-line-length=120
26+
max-line-length = 120

0 commit comments

Comments
 (0)