-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Don't skip fixtures that are substrings of params #926
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 |
---|---|---|
|
@@ -1818,7 +1818,7 @@ def pytest_generate_tests(self, metafunc): | |
if fixturedef.params is not None: | ||
func_params = getattr(getattr(metafunc.function, 'parametrize', None), 'args', [[None]]) | ||
# skip directly parametrized arguments | ||
if argname not in func_params and argname not in func_params[0]: | ||
if argname not in func_params: | ||
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. I didn't figure out why this line is needed. It has been introduced with https://bitbucket.org/pytest-dev/pytest/pull-requests/257/allow-to-override-parametrized-fixtures I suppose it's due to strings like |
||
metafunc.parametrize(argname, fixturedef.params, | ||
indirect=True, scope=fixturedef.scope, | ||
ids=fixturedef.ids) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -412,9 +412,19 @@ def value(): | |
['overridden']) | ||
def test_overridden_via_param(value): | ||
assert value == 'overridden' | ||
|
||
@pytest.mark.parametrize('somevalue', ['overridden']) | ||
def test_not_overridden(value, somevalue): | ||
assert value == 'value' | ||
assert somevalue == 'overridden' | ||
|
||
@pytest.mark.parametrize('other,value', [('foo', 'overridden')]) | ||
def test_overridden_via_multiparam(other, value): | ||
assert other == 'foo' | ||
assert value == 'overridden' | ||
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. Just for completeness, can you add a |
||
""") | ||
rec = testdir.inline_run() | ||
rec.assertoutcome(passed=1) | ||
rec.assertoutcome(passed=3) | ||
|
||
|
||
def test_parametrize_overrides_parametrized_fixture(self, testdir): | ||
|
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.
I think you forgot to add yourself to
AUTHORS
.