Skip to content

Commit 85c1893

Browse files
Merge remote-tracking branch 'upstream/master' into enable_gherkin_output_with_expand_option
2 parents fb04d98 + 72a8764 commit 85c1893

File tree

13 files changed

+90
-62
lines changed

13 files changed

+90
-62
lines changed

.travis.yml

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,12 @@
11
dist: xenial
22
language: python
3-
python: "2.7"
3+
python:
4+
- "2.7"
5+
- "3.5"
6+
- "3.6"
7+
- "3.7"
48

5-
matrix:
6-
include:
7-
- python: "2.7"
8-
env: TOXENV=py27-pytestlatest-linters
9-
- env: TOXENV=py27-pytest33
10-
- env: TOXENV=py27-pytest34
11-
- env: TOXENV=py27-pytest35
12-
- env: TOXENV=py27-pytest36
13-
- env: TOXENV=py27-pytest37
14-
- env: TOXENV=py27-pytest38
15-
- env: TOXENV=py27-pytest39
16-
- env: TOXENV=py27-pytest310
17-
- env: TOXENV=py27-pytest40
18-
- env: TOXENV=py27-pytest41
19-
- env: TOXENV=py27-pytest42
20-
- env: TOXENV=py27-pytestlatest
21-
- env: TOXENV=py27-pytestlatest-xdist
22-
- env: TOXENV=py34-pytestlatest
23-
python: "3.4"
24-
- env: TOXENV=py35-pytestlatest
25-
python: "3.5"
26-
- env: TOXENV=py36-pytestlatest
27-
python: "3.6"
28-
- env: TOXENV=py37-pytestlatest
29-
python: "3.7"
30-
- env: TOXENV=py27-pytestlatest-coveralls
31-
32-
install: pip install tox
9+
install: pip install tox tox-travis
3310

3411
script: tox --recreate
3512

@@ -39,5 +16,5 @@ branches:
3916

4017
notifications:
4118
email:
42-
43-
19+
20+

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Changelog
44
Unreleased
55
----------
66

7+
3.1.1
8+
----------
9+
10+
- Allow unicode string in ``@given()`` step names when using python2.
11+
This makes the transition of projects from python 2 to 3 easier.
12+
713
3.1.0
814
----------
915

pytest_bdd/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
from pytest_bdd.steps import given, when, then
44
from pytest_bdd.scenario import scenario, scenarios
55

6-
__version__ = '3.1.0'
6+
__version__ = '3.1.1'
77

88
__all__ = [given.__name__, when.__name__, then.__name__, scenario.__name__, scenarios.__name__]

pytest_bdd/steps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def step_func(request):
8585

8686
step_func.step_type = GIVEN
8787
step_func.converters = converters
88-
step_func.__name__ = name
88+
step_func.__name__ = force_encode(name, 'ascii')
8989
step_func.fixture = fixture
9090
func = pytest.fixture(scope=scope)(lambda: step_func)
9191
func.__doc__ = 'Alias for the "{0}" fixture.'.format(fixture)

requirements-testing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
mock
2-
pytest-pep8
32
coverage<4.0a1
43
pytest-cache
4+
pycodestyle

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
[wheel]
22
universal = 1
33

4+
[pycodestyle]
5+
max-line-length = 120

tests/feature/test_cucumber_json.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ def __cmp__(self, other):
3131

3232
def test_step_trace(testdir):
3333
"""Test step trace."""
34+
testdir.makefile(".ini", pytest=textwrap.dedent("""
35+
[pytest]
36+
markers =
37+
scenario-passing-tag
38+
scenario-failing-tag
39+
scenario-outline-passing-tag
40+
feature-tag
41+
"""))
3442
testdir.makefile('.feature', test=textwrap.dedent("""
3543
@feature-tag
3644
Feature: One passing scenario, one failing scenario
@@ -273,6 +281,12 @@ def test_passing_outline():
273281

274282
def test_step_trace_with_expand_option(testdir):
275283
"""Test step trace."""
284+
testdir.makefile(".ini", pytest=textwrap.dedent("""
285+
[pytest]
286+
markers =
287+
feature-tag
288+
scenario-outline-passing-tag
289+
"""))
276290
testdir.makefile('.feature', test=textwrap.dedent("""
277291
@feature-tag
278292
Feature: One scenario outline, expanded to multiple scenarios
@@ -299,7 +313,7 @@ def type_type_and_value_value():
299313
def test_passing_outline():
300314
pass
301315
"""))
302-
result, jsonobject = runandparse(testdir, '--cucumber-json-expand')
316+
result, jsonobject = runandparse(testdir, '--cucumber-json-expanded')
303317
assert result.ret == 0
304318

305319
assert jsonobject[0]["elements"][0]["steps"][0]["name"] == "type str and value hello"

tests/feature/test_report.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ def __cmp__(self, other):
2323

2424
def test_step_trace(testdir):
2525
"""Test step trace."""
26+
testdir.makefile(".ini", pytest=textwrap.dedent("""
27+
[pytest]
28+
markers =
29+
feature-tag
30+
scenario-passing-tag
31+
scenario-failing-tag
32+
"""))
2633
feature = testdir.makefile('.feature', test=textwrap.dedent("""
2734
@feature-tag
2835
Feature: One passing scenario, one failing scenario

tests/feature/test_reuse.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def appends_1(empty_list):
2121
empty_list.append(1)
2222
return empty_list
2323

24+
2425
given('I have a fixture (appends 1 to a list) in reuse syntax', fixture='appends_1')
2526

2627

tests/feature/test_tags.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
"""Test tags."""
2-
import pytest
3-
4-
from pytest_bdd import scenario, feature
2+
import textwrap
53

4+
import pytest
65

7-
def test_tags(request):
8-
"""Test tags for the scenario and the feature."""
9-
@scenario(
10-
'tags.feature',
11-
'Tags'
12-
)
13-
def test():
14-
pass
15-
16-
assert test.__scenario__.tags == set(['scenario_tag_1', 'scenario_tag_2'])
17-
assert test.__scenario__.feature.tags == set(['feature_tag_1', 'feature_tag_2'])
18-
test(request)
6+
from pytest_bdd import feature
197

208

219
def test_tags_selector(testdir):
2210
"""Test tests selection by tags."""
11+
testdir.makefile(".ini", pytest=textwrap.dedent("""
12+
[pytest]
13+
markers =
14+
feature_tag_1
15+
feature_tag_2
16+
scenario_tag_01
17+
scenario_tag_02
18+
scenario_tag_10
19+
scenario_tag_20
20+
"""))
2321
testdir.makefile('.feature', test="""
2422
@feature_tag_1 @feature_tag_2
2523
Feature: Tags
@@ -43,9 +41,10 @@ def i_have_bar():
4341
4442
scenarios('test.feature')
4543
""")
46-
result = testdir.runpytest('-m', 'scenario_tag_10 and not scenario_tag_01', '-vv').parseoutcomes()
47-
assert result['passed'] == 1
48-
assert result['deselected'] == 1
44+
result = testdir.runpytest('-m', 'scenario_tag_10 and not scenario_tag_01', '-vv')
45+
outcomes = result.parseoutcomes()
46+
assert outcomes['passed'] == 1
47+
assert outcomes['deselected'] == 1
4948

5049
result = testdir.runpytest('-m', 'scenario_tag_01 and not scenario_tag_10', '-vv').parseoutcomes()
5150
assert result['passed'] == 1
@@ -60,6 +59,10 @@ def i_have_bar():
6059

6160
def test_tags_after_background_issue_160(testdir):
6261
"""Make sure using a tag after background works."""
62+
testdir.makefile(".ini", pytest=textwrap.dedent("""
63+
[pytest]
64+
markers = tag
65+
"""))
6366
testdir.makefile('.feature', test="""
6467
Feature: Tags after background
6568
@@ -132,6 +135,11 @@ def i_have_bar():
132135

133136

134137
def test_tag_with_spaces(testdir):
138+
testdir.makefile(".ini", pytest=textwrap.dedent("""
139+
[pytest]
140+
markers =
141+
test with spaces
142+
"""))
135143
testdir.makeconftest("""
136144
import pytest
137145

0 commit comments

Comments
 (0)