Skip to content

Work with behave from master branch (aka 1.2.6) now #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion allure-behave/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
]

install_requires = [
"behave==1.2.5",
"behave>=1.2.5",
"allure-python-commons==2.2.3b1"
]

Expand Down
5 changes: 1 addition & 4 deletions allure-behave/src/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from allure_commons.model2 import TestStepResult
from allure_commons.model2 import TestBeforeResult, TestAfterResult
from allure_commons.model2 import TestResultContainer
from allure_commons.model2 import Status, Parameter, Label
from allure_commons.model2 import Parameter, Label
from allure_behave.utils import scenario_parameters
from allure_behave.utils import scenario_severity
from allure_behave.utils import scenario_tags
Expand All @@ -23,7 +23,6 @@
from allure_behave.utils import get_status, get_status_details



BEFORE_FIXTURES = ['before_all', 'before_tag', 'before_feature', 'before_scenario']
AFTER_FIXTURES = ['after_all', 'after_tag', 'after_feature', 'after_scenario']
FIXTURES = BEFORE_FIXTURES + AFTER_FIXTURES
Expand Down Expand Up @@ -162,7 +161,6 @@ def stop_step(self, uuid, exc_type, exc_val, exc_tb):
status=get_status(exc_val),
statusDetails=get_status_details(exc_type, exc_val, exc_tb))


@allure_commons.hookimpl
def attach_data(self, body, name, attachment_type, extension):
self.logger.attach_data(uuid4(), body, name=name, attachment_type=attachment_type, extension=extension)
Expand All @@ -185,4 +183,3 @@ def enter(self, _list=list()):
def exit(self):
gone, self[:] = self[:], self._stack.pop()
return gone

8 changes: 6 additions & 2 deletions allure-behave/src/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from enum import Enum
from behave.model import ScenarioOutline
from behave.runner_util import make_undefined_step_snippet
from allure_commons.types import Severity
from allure_commons.model2 import Status, Parameter, Label
from allure_commons.model2 import Status, Parameter
from allure_commons.model2 import StatusDetails
from allure_commons.utils import md5
from allure_commons.utils import format_exception, format_traceback
Expand Down Expand Up @@ -74,7 +75,10 @@ def step_status(result):
if result.exception:
return get_status(result.exception)
else:
return STATUS.get(result.status, None)
if isinstance(result.status, Enum):
return STATUS.get(result.status.name, None)
else:
return STATUS.get(result.status, None)


def get_status(exception):
Expand Down
45 changes: 36 additions & 9 deletions allure-behave/tox.ini
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
[tox]
envlist=
envlist =
py{27,33,34,35}
static_check

[testenv]
passenv =
HOME
passenv = HOME

setenv =
TEST_TMP={envtmpdir}
ALLURE_INDENT_OUTPUT=yep

whitelist_externals = rm

deps=
{distshare}/allure-python-commons-2*.zip
{distshare}/allure-python-commons-test-2*.zip

commands=
rm -rf {envtmpdir}/*
behave -f allure_behave.formatter:AllureFormatter -o {envtmpdir}/allrue-result -f pretty {posargs: ./features}


[testenv:behave-master]
passenv = HOME

basepython = python3.5

setenv =
TEST_TMP={envtmpdir}
ALLURE_INDENT_OUTPUT=yep

whitelist_externals = rm

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

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


[testenv:demo]
passenv =
HOME
passenv = HOME

setenv =
ALLURE_INDENT_OUTPUT=yep
Expand All @@ -37,9 +55,18 @@ whitelist_externals =
mkdir
bash

commands=
python setup.py develop
commands =
rm -rf {envtmpdir}/*
- behave -v {posargs: ./features}
mkdir {envtmpdir}/demo
bash -c 'find {envtmpdir}/ -type f -exec cp -rfp \{\} {envtmpdir}/demo/ \;'
bash -c 'find {envtmpdir}/ -type f -exec cp -rfp \{\} {envtmpdir}/demo/ \;'


[testenv:static_check]
deps = flake8

commands = flake8 src/


[flake8]
max-line-length = 120
35 changes: 14 additions & 21 deletions allure-pytest/tox.ini
Original file line number Diff line number Diff line change
@@ -1,41 +1,39 @@
[tox]
envlist=
envlist =
py{27,33,34,35}
xdist
static_check


[testenv]
passenv =
HOME
passenv = HOME

whitelist_externals = rm

deps=
deps =
pyhamcrest
{distshare}/allure-python-commons-2*.zip
{distshare}/allure-python-commons-test-2*.zip

commands=
python setup.py develop
commands =
rm -f {envtmpdir}/*.json
py.test --doctest-module --alluredir={envtmpdir} {posargs: ./test/}


[testenv:xdist]
passenv =
HOME
passenv = HOME

basepython = python3.5

whitelist_externals = rm

deps=
deps =
pyhamcrest
pytest-xdist
{distshare}/allure-python-commons-2*.zip
{distshare}/allure-python-commons-test-2*.zip

commands=
python setup.py develop
commands =
rm -f {envtmpdir}/*.json
py.test -n 4 --doctest-module --alluredir={envtmpdir} {posargs: ./test/}

Expand All @@ -46,27 +44,22 @@ commands=
# `tox -e demo -- -k test_single_feature_label` or
# `tox -e demo -- ./test/steps/`
[testenv:demo]
passenv =
HOME
passenv = HOME

whitelist_externals = rm

setenv =
ALLURE_INDENT_OUTPUT=yep
setenv = ALLURE_INDENT_OUTPUT=yep

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


[testenv:static_check]
deps=
flake8
deps = flake8

commands=
flake8 src/
commands = flake8 src/


[flake8]
max-line-length=120
max-line-length = 120
6 changes: 2 additions & 4 deletions allure-python-commons-test/tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
[tox]
envlist=
py{27,33,34,35}
envlist = py{27,33,34,35}


[testenv]
passenv =
HOME
passenv = HOME

commands=
python setup.py develop
Expand Down
11 changes: 4 additions & 7 deletions allure-python-commons/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ envlist=


[testenv]
passenv =
HOME
passenv = HOME

deps=
pytest
Expand All @@ -18,12 +17,10 @@ commands=


[testenv:static_check]
deps=
flake8
deps = flake8

commands=
flake8 src/
commands = flake8 src/


[flake8]
max-line-length=120
max-line-length = 120