Skip to content

Commit 8822915

Browse files
authored
Merge pull request #383 from pytest-dev/update-pytests
Update pytests
2 parents 86e9762 + fc9adba commit 8822915

13 files changed

+81
-20
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/psf/black
5-
rev: 19.3b0
5+
rev: 20.8b1
66
hooks:
77
- id: black
88
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v2.3.0
9+
rev: v3.2.0
1010
hooks:
1111
- id: trailing-whitespace
1212
- id: end-of-file-fixer

pytest_bdd/gherkin_terminal_reporter.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ class GherkinTerminalReporter(TerminalReporter):
5151
def __init__(self, config):
5252
TerminalReporter.__init__(self, config)
5353

54-
def pytest_runtest_logstart(self, nodeid, location):
55-
# Prevent locationline from being printed since we already
56-
# show the module_name & in verbose mode the test name.
57-
pass
58-
5954
def pytest_runtest_logreport(self, report):
6055
rep = report
6156
res = self.config.hook.pytest_report_teststatus(report=rep, config=self.config)

pytest_bdd/scenario.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,12 @@ def scenario_wrapper(request):
198198

199199

200200
def scenario(
201-
feature_name, scenario_name, encoding="utf-8", example_converters=None, caller_module=None, features_base_dir=None,
201+
feature_name,
202+
scenario_name,
203+
encoding="utf-8",
204+
example_converters=None,
205+
caller_module=None,
206+
features_base_dir=None,
202207
):
203208
"""Scenario decorator.
204209

requirements-testing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
mock
1+
packaging

tests/feature/test_cucumber_json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def test_passing_outline():
155155
"line": 12,
156156
"match": {"location": ""},
157157
"name": "a failing step",
158-
"result": {"error_message": OfType(string), "status": "failed", "duration": OfType(int),},
158+
"result": {"error_message": OfType(string), "status": "failed", "duration": OfType(int)},
159159
},
160160
],
161161
"tags": [{"name": "scenario-failing-tag", "line": 9}],

tests/feature/test_outline.py

Lines changed: 5 additions & 4 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,11 +112,11 @@ 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
)
118-
result.stdout.fnmatch_lines("*should match set of example values [[]'eat', 'left', 'start', 'unknown_param'[]].*",)
119+
result.stdout.fnmatch_lines("*should match set of example values [[]'eat', 'left', 'start', 'unknown_param'[]].*")
119120

120121

121122
def test_wrong_vertical_examples_scenario(testdir):
@@ -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

tests/steps/test_steps.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def test_when_then(request):
4242

4343

4444
@pytest.mark.parametrize(
45-
("step", "keyword"), [("given", "Given"), ("when", "When"), ("then", "Then")],
45+
("step", "keyword"),
46+
[("given", "Given"), ("when", "When"), ("then", "Then")],
4647
)
4748
def test_preserve_decorator(testdir, step, keyword):
4849
"""Check that we preserve original function attributes after decorating it."""

0 commit comments

Comments
 (0)