Skip to content

Commit 1278cd9

Browse files
committed
Update tests based on feedback
1 parent 3c3fa77 commit 1278cd9

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

tests/datatable/test_datatable.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ def test_datatable():
9797
]
9898

9999

100-
def test_steps_with_missing_datatables(pytester):
100+
def test_datatable_argument_in_step_impl_is_optional(pytester):
101101
pytester.makefile(
102102
".feature",
103-
missing_datatable=textwrap.dedent(
103+
optional_arg_datatable=textwrap.dedent(
104104
"""\
105105
Feature: Missing data table
106106
@@ -142,11 +142,9 @@ def _(datatable):
142142
pytester.makepyfile(
143143
textwrap.dedent(
144144
"""\
145-
from pytest_bdd import scenario
145+
from pytest_bdd import scenarios
146146
147-
@scenario("missing_datatable.feature", "Data table is missing for a step")
148-
def test_datatable():
149-
pass
147+
scenarios("optional_arg_datatable.feature")
150148
"""
151149
)
152150
)

tests/steps/test_docstring.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ def test_steps_with_docstrings(pytester):
4040
4141
@given("a step has a docstring")
4242
def _(docstring):
43-
given_docstring = docstring.strip()
43+
given_docstring = docstring
4444
dump_obj(given_docstring)
4545
4646
4747
@when("a step provides a docstring with lower indentation")
4848
def _(docstring):
49-
when_docstring = docstring.strip()
49+
when_docstring = docstring
5050
dump_obj(when_docstring)
5151
5252
@@ -57,7 +57,7 @@ def _():
5757
5858
@then("this step has a greater indentation")
5959
def _(docstring):
60-
then_docstring = docstring.strip()
60+
then_docstring = docstring
6161
dump_obj(then_docstring)
6262
"""
6363
)
@@ -66,11 +66,9 @@ def _(docstring):
6666
pytester.makepyfile(
6767
textwrap.dedent(
6868
"""\
69-
from pytest_bdd import scenario
69+
from pytest_bdd import scenarios
7070
71-
@scenario("docstring.feature", "Step with plain docstring as multiline step")
72-
def test_docstring():
73-
pass
71+
scenarios("docstring.feature")
7472
"""
7573
)
7674
)
@@ -127,11 +125,9 @@ def _():
127125
pytester.makepyfile(
128126
textwrap.dedent(
129127
"""\
130-
from pytest_bdd import scenario
128+
from pytest_bdd import scenarios
131129
132-
@scenario("missing_docstring.feature", "Docstring is missing for a step")
133-
def test_docstring():
134-
pass
130+
scenarios("missing_docstring.feature")
135131
"""
136132
)
137133
)
@@ -140,10 +136,10 @@ def test_docstring():
140136
result.stdout.fnmatch_lines(["*fixture 'docstring' not found*"])
141137

142138

143-
def test_steps_with_docstring_missing_argument_in_step_def(pytester):
139+
def test_docstring_argument_in_step_impl_is_optional(pytester):
144140
pytester.makefile(
145141
".feature",
146-
missing_docstring_arg=textwrap.dedent(
142+
optional_docstring_arg=textwrap.dedent(
147143
'''\
148144
Feature: Missing docstring
149145
@@ -189,11 +185,9 @@ def _():
189185
pytester.makepyfile(
190186
textwrap.dedent(
191187
"""\
192-
from pytest_bdd import scenario
188+
from pytest_bdd import scenarios
193189
194-
@scenario("missing_docstring_arg.feature", "Docstring arg is missing for a step definition")
195-
def test_docstring():
196-
pass
190+
scenarios("optional_docstring_arg.feature")
197191
"""
198192
)
199193
)

0 commit comments

Comments
 (0)