--- you can reply above this line --- New issue 197: Failing to parameterize leaves metafunc unparameterized, resulting in error https://bitbucket.org/hpk42/pytest/issue/197/failing-to-parameterize-leaves-metafunc
Jason R. Coombs: We have a test where we often want to run it against a varying number of parameters (pulled from a live environment): {{{ @pytest.mark.parametrize(('region', 'name'), list(questionnaires_under_test())) def test_questionnaire(region, name): ... }}} The function 'questionnaires_under_test' could generate 0 or more results. If it generates 0 results, simulated by this code: {{{ @pytest.mark.parametrize(('region', 'name'), []) def test_questionnaire(region, name): ... }}} however, the test fails with this error: {{{ LookupError: no factory found for argument 'region' available funcargs: pytestconfig, selenium, recwarn, pony_survey, monkeypatch, simple_survey, capfd, pdl_gender_survey, capsys, tmpdir use 'py.test --funcargs [testpath]' for help on them. }}} Since pytest has already had the opportunity to parameterize that function, but nothing was suitable, it would be nice if pytest could remove that test from the tests to be run and not raise the error. I've been able to work around the issue by skipping the entire file if no questionnaires would be generated: {{{ if not pytest.config.option.live_questionnaires: pytest.skip() }}} Another way to describe this issue, pytest allows for parameterization of 1 or more inputs, but doesn't handle 0 or more very well. It's conceivable to me that pytest could handle the null case without raising an error. If that's the case, please consider it for a future improvement. I realize there might be some complications in how parameterization works that would make this a challenging improvement. If that's the case, it's probably not worth it. -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev