Skip to content

Commit 0408218

Browse files
committed
Use compatibility function to assert outcomes
1 parent 29c8c69 commit 0408218

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

tests/feature/test_outline.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Scenario Outline tests."""
22
import textwrap
33

4+
from tests.utils import assert_outcomes
45

56
STEPS = """\
67
from pytest_bdd import given, when, then
@@ -111,7 +112,7 @@ def test_outline(request):
111112
)
112113
)
113114
result = testdir.runpytest()
114-
result.assert_outcomes(error=1)
115+
assert_outcomes(result, errors=1)
115116
result.stdout.fnmatch_lines(
116117
'*ScenarioExamplesNotValidError: Scenario "Outlined with wrong examples"*has not valid examples*',
117118
)
@@ -151,7 +152,7 @@ def test_outline(request):
151152
)
152153
)
153154
result = testdir.runpytest()
154-
result.assert_outcomes(error=1)
155+
assert_outcomes(result, errors=1)
155156
result.stdout.fnmatch_lines(
156157
"*Scenario has not valid examples. Example rows should contain unique parameters. "
157158
'"start" appeared more than once.*'
@@ -192,7 +193,7 @@ def test_outline(request):
192193
)
193194
)
194195
result = testdir.runpytest()
195-
result.assert_outcomes(error=1)
196+
assert_outcomes(result, errors=1)
196197
result.stdout.fnmatch_lines(
197198
"*Feature has not valid examples. Example rows should contain unique parameters. "
198199
'"start" appeared more than once.*'

tests/feature/test_scenario.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import textwrap
44

5+
from tests.utils import assert_outcomes
6+
57

68
def test_scenario_not_found(testdir):
79
"""Test the situation when scenario is not found."""
@@ -30,7 +32,7 @@ def test_not_found():
3032
)
3133
result = testdir.runpytest()
3234

33-
result.assert_outcomes(error=1)
35+
assert_outcomes(result, errors=1)
3436
result.stdout.fnmatch_lines('*Scenario "NOT FOUND" in feature "Scenario is not found" in*')
3537

3638

tests/feature/test_wrong.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import textwrap
44

5+
from tests.utils import assert_outcomes
6+
57

68
def test_multiple_features_single_file(testdir):
79
"""Test validation error when multiple features are placed in a single file."""
@@ -49,5 +51,5 @@ def test_wrong():
4951
)
5052
)
5153
result = testdir.runpytest()
52-
result.assert_outcomes(error=1)
54+
assert_outcomes(result, errors=1)
5355
result.stdout.fnmatch_lines("*FeatureError: Multiple features are not allowed in a single feature file.*")

tests/generation/test_generate_missing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import textwrap
44

55
from pytest_bdd.scenario import get_python_name_generator
6+
from tests.utils import assert_outcomes
67

78

89
def test_python_name_generator():
@@ -60,7 +61,7 @@ def test_missing_steps():
6061
)
6162

6263
result = testdir.runpytest("--generate-missing", "--feature", "generation.feature")
63-
result.assert_outcomes(passed=0, failed=0, error=0)
64+
assert_outcomes(result, passed=0, failed=0, errors=0)
6465
assert not result.stderr.str()
6566
assert result.ret == 0
6667

0 commit comments

Comments
 (0)