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
Possible to expand the fixture return value in parametrize? #9
Comments
Hi! Yes, you can do it with pytest-lazy-fixture: @pytest.fixture
def links(browser): # assume browser was a fixture
return browser.find_by_tag('a')
@pytest.mark.parametrize("link", [
pytest.lazy_fixture('links')
]) # here expand the links fixture return value
def test_func(link):
# test that link here |
This way i get following error:
|
There was a similar issue: #6. For now It's not possible to implement this feature. |
If you have some other issues or questions feel free to reopen it or create another one |
I'm interested in something like that. Did the situation change? is it possible to implement this today? if not, why not? |
Check out pytest-dev/pytest#4050. I think the main reason here is that you want to generate test cases during runtime, and pytest can do it only during the collection stage. Although I'm not sure. |
It is looking like this collection stage constraint is indeed what may be lurking here...
|
I would like to parametrize a test with the return value of a fixture.
Example:
Is this possible with pytest-lazy-fixture? (or maybe even pytest itself?) Or might it be a nice feature?
The text was updated successfully, but these errors were encountered: