Skip to content

pytest.mark.parameterize "fixture input not found" #695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pytestbot opened this issue Mar 9, 2015 · 4 comments
Closed

pytest.mark.parameterize "fixture input not found" #695

pytestbot opened this issue Mar 9, 2015 · 4 comments
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Alec Reiter (BitBucket: justanr, GitHub: justanr)


I'm writing tests for a small library and I decided to use py.test after hearing so many good things about it.

However, pytest.mark.parameterize is giving me some issues. At first, I thought maybe I just mismatched some parens and it went off looking for a fixture elsewhere. So I decided to start with the given example of parameterize:

@pytest.mark.parametrize("input,expected", [
    ("3+5", 8),
    ("2+4", 6),
    ("6*9", 42),
])
def test_eval(input, expected):
    assert eval(input) == expected

But this gives the same error:

fixture 'input' not found

available fixtures: capfd, pytestconfig, recwarn, capsys, tmpdir, monkeypatch

use 'py.test --fixtures [testpath]' for help on them.

I went off googling, but I couldn't find any answers that applied. Any ideas on how to approach this?

I'm running Python 3.4.0 and py.test 2.6.4 inside of a virtualenv.


@pytestbot
Copy link
Contributor Author

Original comment by Brianna Laugher (BitBucket: pfctdayelise, GitHub: pfctdayelise):


Please note carefully the spelling: parametrize not parameterize. i.e, #463.

@pytestbot
Copy link
Contributor Author

Original comment by Brianna Laugher (BitBucket: pfctdayelise, GitHub: pfctdayelise):


Duplicate of #463.

@pytestbot
Copy link
Contributor Author

Original comment by Alec Reiter (BitBucket: justanr, GitHub: justanr):


I just noticed that and came here to note that I am not very good at spelling. I suppose pytest.mark is generating parametrize automatically from the name, thus it not throwing an error for poor spelling?

@pytestbot
Copy link
Contributor Author

Original comment by Brianna Laugher (BitBucket: pfctdayelise, GitHub: pfctdayelise):


Well, you can put literally any mark you want (at the moment - there are
some plans for marks to be predefined/limited by default, but this is not
the current default). You can use them like tags to group related tests in
a very lightweight fashion (then specify that mark to select only those
tests to run). Parametrize is one of the special cases which has extra
behaviour. If you misspell it, pytest just treats it like a tag, but then
the test function doesn't know where its input is coming from, hence the
error about undefined fixtures.

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant