-
-
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
Conversation
@@ -1777,7 +1777,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]: |
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 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 value,othervalue
, but it doesn't seem like it's actually needed (see new python/collect.py
-testcases). In other words, no item of func_params
ever contains a comma.
cc @bubenkoff |
|
||
@pytest.mark.parametrize('other,value', [('foo', 'overridden')]) | ||
def test_overridden_via_multiparam(other, value): | ||
assert value == 'overridden' |
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.
Just for completeness, can you add a assert other == 'foo'
here?
Thanks for the PR @untitaker! 😄 Could you please also add a note to the |
Also fix some inconsistencies in the changelog on the way.
Done. I'm not really sure what I did was the right fix though -- I think this should be confirmed somehow. |
Thanks! I'm not familiar with that part of the code, but based from the tests it seems the change is OK to me. Let's wait for @bubenkoff's feedback. 😄 |
@@ -1,10 +1,14 @@ | |||
2.8.0.dev (compared to 2.7.X) | |||
----------------------------- | |||
|
|||
- Fix issue736: Fix a bug where fixture params would be discarded when combined | |||
with parametrization markers. | |||
Thanks to Markus Unterwaditzer for the PR. |
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
.
Added myself and also resorted list. |
Thanks! 🍻 |
The code should use a string split there I think, and the implementation seems incomplete to begin with this one seems tricky |
The thing is, I couldn't craft a testcase that fails with this patch. On 8 August 2015 06:22:41 CEST, Ronny Pfannschmidt [email protected] wrote:
Sent from my phone. Please excuse my brevity. |
since its an improvements i'm + 1 on merging it anyway, but i suspect we will find an issue at some point in future |
If you like, I could add an extra assertion:
|
i don't think that would help, i'd really love to have marker signatures at that point func params is the argument tuple of the marker and it should check the first argument and always turn it into a tuple of names for that particular check (i.e. if its a string, do a ','. split, then do the in check |
My point is that this particular piece of code apparently never gets to see a list of strings that contain commas. I can add that assertion and the tests still pass. |
Also fix some inconsistencies in the changelog on the way.
Rebased to resolve conflicts in CHANGELOG. |
Anything else needed to get this merged? On 8 August 2015 13:41:26 CEST, Ronny Pfannschmidt [email protected] wrote:
Sent from my phone. Please excuse my brevity. |
Looks 👍 to me! @RonnyPfannschmidt, if you're OK with it, could you please merge this? 😄 |
ok on the merge, will pull in once im at home github really needs a merge strategy for CHANGELOG |
If GitHub reads |
nice! On 10/08/2015, Florian Bruhin [email protected] wrote:
Anatoly Bubenkov |
@The-Compiler great idea 👍 |
👍 |
I did a quick test in |
Hmm I just pushed a |
296292f
to
bb3935c
Compare
Also fix some inconsistencies in the changelog on the way.
Rebase worked fine/nicer though. |
Oh well, let's keep an eye on future PRs then. 😄 |
bb3935c
to
296292f
Compare
296292f
to
2a745c8
Compare
Also fix some inconsistencies in the changelog on the way.
Just temporarily undid the rebase and it indeed seems that GitHub doesn't care about the .gitattributes file. :( |
😑 |
Also fix some inconsistencies in the changelog on the way.
2a745c8
to
1d5215a
Compare
Don't skip fixtures that are substrings of params
Thanks again @untitaker! |
Fix #736