-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix overriding of fixtures with parametrization. #983
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1614,6 +1614,26 @@ def test_issue(foo, foobar): | |
reprec = testdir.inline_run() | ||
reprec.assertoutcome(passed=9) | ||
|
||
@pytest.mark.parametrize('param_args', ["'fixt, val'", "'fixt,val'", "['fixt', 'val']", "('fixt', 'val')"]) | ||
def test_override_parametrized_fixture_issue_979(self, testdir, param_args): | ||
"""Make sure a parametrized argument can override a parametrized fixture. | ||
|
||
This was a regression introduced in the fix for #736. | ||
""" | ||
testdir.makepyfile(""" | ||
import pytest | ||
|
||
@pytest.fixture(params=[1, 2]) | ||
def fixt(request): | ||
return request.param | ||
|
||
@pytest.mark.parametrize(%s, [(3, 'x'), (4, 'x')]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls use .format for string formatting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. valid point, agreed |
||
def test_foo(fixt, val): | ||
pass | ||
""" % param_args) | ||
reprec = testdir.inline_run() | ||
reprec.assertoutcome(passed=2) | ||
|
||
def test_scope_session(self, testdir): | ||
testdir.makepyfile(""" | ||
import pytest | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls document what exactly you're testing