You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When indenting one And step definition after a Given step definition, pytest will incorrectly parse both steps as one.
Example - feature file:
Scenario: List all pizzas as restaurant user
Given No pizza used in testing is in the database
And I'm a restaurant user
When I go to the pizza endpoint
Then I should see a list of pizzas
The given example will trigger the following error when the file is parsed:
request = <FixtureRequest for <Function test_endpoint>>, step = <pytest_bdd.feature.Step object at 0x7f7ad9520d30>,
scenario = <pytest_bdd.feature.Scenario object at 0x7f7ad9520e50>, encoding = 'utf-8'
def _find_step_function(request, step, scenario, encoding):
"""Match the step defined by the regular expression pattern.
:param request: PyTest request object.
:param step: Step.
:param scenario: Scenario.
:return: Function of the step.
:rtype: function
"""
name = step.name
try:
# Simple case where no parser is used for the step
return request.getfixturevalue(get_step_fixture_name(name, step.type, encoding))
except pytest_fixtures.FixtureLookupError:
try:
# Could not find a fixture with the same name, let's see if there is a parser involved
name = find_argumented_step_fixture_name(name, step.type, request._fixturemanager, request)
if name:
return request.getfixturevalue(name)
raise
except pytest_fixtures.FixtureLookupError:
> raise exceptions.StepDefinitionNotFoundError(
u"""Step definition is not found: {step}."""
""" Line {step.line_number} in scenario "{scenario.name}" in the feature "{feature.filename}""".format(
step=step, scenario=scenario, feature=scenario.feature
)
)
E pytest_bdd.exceptions.StepDefinitionNotFoundError: Step definition is not found: Given "No pizza used in testing is in the database
E And I'm a restaurant user". Line 11 in scenario "List all pizzas as restaurant user" in the feature "/usr/pizzaservice/test/service/api/v1/features/pizza_tests.feature
../local/lib/python3.8/site-packages/pytest_bdd/scenario.py:86: StepDefinitionNotFoundError
This is pytest version 5.4.2, imported from /usr/local/lib/python3.8/site-packages/pytest/__init__.py
setuptools registered plugins:
pytest-bdd-3.3.0 at /usr/local/lib/python3.8/site-packages/pytest_bdd/plugin.py
pytest-pgsql-1.1.2 at /usr/local/lib/python3.8/site-packages/pytest_pgsql/plugin.py
pytest-cov-2.9.0 at /usr/local/lib/python3.8/site-packages/pytest_cov/plugin.py
pytest-mock-2.0.0 at /usr/local/lib/python3.8/site-packages/pytest_mock/__init__.py
Operating system/IDE:
Ubuntu 20.04 LTS
PyCharm 2020.1.2 (Professional)
The text was updated successfully, but these errors were encountered:
Closing as this is not valid gherkin syntax. When the official parser/new parser is going to be released, this syntax is not going to be allowed at all.
When indenting one
And
step definition after aGiven
step definition, pytest will incorrectly parse both steps as one.Example - feature file:
The given example will trigger the following error when the file is parsed:
pip list
output:PyTest version:
Operating system/IDE:
The text was updated successfully, but these errors were encountered: