I have a trivial test:
import pytestIt fails saying:
@pytest.mark.parameterize(("input", "expected"), [
("3+5", 8),
("2+4", 6),
("6*9", 42),
])
def test_eval(input, expected):
assert eval(input) == expected
LookupError: no factory found for function argument 'input'What's going on here? It's spelt parametrize – not parameterize.
available funcargs: pytestconfig, capsys, capfd, tmpdir, monkeypatch, recwarn
use 'py.test --funcargs [testpath]' for help on them.
But why didn't I get a NameError?
pytest.mark allows arbitrary marks to be added to a function. Due to the
dynamic nature of py.test, pytest.mark.<any name here> can be used to mark a
test. Since pytest.mark.parameterize isn't recognised by any of the pytest
plugins, it's essentially a no-op.
No comments:
Post a Comment