Closed jtpereyda closed 8 years ago
README references @mark.scenario decorator from pytest.mark, but it appears that plain old @scenario from pytest is the way to go.
@mark.scenario
pytest.mark
@scenario
pytest
According to the readme, you can parameterize tests like this (selected excerpts from example):
import pytest from pytest_bdd import mark, given, when, then ... @pytest.mark.parametrize( ['start', 'eat', 'left'], [(12, 5, 7)]) @mark.scenario( 'parametrized.feature', 'Parametrized given, when, thens', ) ... def test_parametrized(start, eat, left): ...
However, these import lines fail for me with the latest pytest-bdd:
$ cat test_import_fail.py import pytest import pytest_bdd print("pytest: {0}", pytest.__version__) print("pytest_bdd: {0}", pytest_bdd.__version__) from pytest_bdd import mark, given, when, then $ ./env/bin/python test_import_fail.py pytest: 2.8.5 pytest_bdd: 2.16.0 Traceback (most recent call last): File "test_import_fail.py", line 5, in <module> from pytest_bdd import mark, given, when, then ImportError: cannot import name mark
However, everything works fine for me if I change
from pytest_bdd import mark, given, when, then
to
from pytest_bdd import scenario, given, when, then
and
@mark.scenario(
@scenario(
Change README.
Also "parameterization" is misspelled "parametrization" in the README. Apparently there are four ways to spell parametrise.
Good catch
Closing since PR was merged
tl;dr
README references
@mark.scenario
decorator frompytest.mark
, but it appears that plain old@scenario
frompytest
is the way to go.Problem
According to the readme, you can parameterize tests like this (selected excerpts from example):
However, these import lines fail for me with the latest pytest-bdd:
Solution
However, everything works fine for me if I change
to
and
to
Suggestion
Change README.
Also "parameterization" is misspelled "parametrization" in the README.Apparently there are four ways to spell parametrise.