Skip to content

Request #714: Apply indirect=True on particular argnames #908

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

Merged
merged 10 commits into from
Aug 29, 2015

Conversation

Elizaveta239
Copy link
Contributor

The results of EuroPython 2015 sprint. See #714.

valtype = indirect and "params" or "funcargs"
else:
if not isinstance(indirect, (tuple, list)):
valtypes = {arg: "params" for arg in argnames}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems dict comprehensions are invalid syntax in Python 2.6, which is why the checks are failing. You can probably do something like dict([(arg, "params") for arg in argnames]) instead (but I didn't test it 😉).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nevermind - you were faster! 😆

@nicoddemus
Copy link
Member

Thanks for this @Elizaveta239! Could you please also add a note the the CHANGELOG and add yourself to AUTHORS?

@Elizaveta239
Copy link
Contributor Author

Hi @nicoddemus! Could you help me please? I added a test for bad 'indirect' parameter in order to increase code coverage. But this test isn't marked as 'passed', but marked as 'error'. How should I change it?

@nicoddemus
Copy link
Member

Sure thing, can you post the failing test?

Also, I think this feature deserves some documentation on it... could please add that too? 😄

@Elizaveta239
Copy link
Contributor Author

@nicoddemus I said about 'test_parametrize_indirect_list_error' in metafunc.py. But now I figured out that the problem appeared because of my local changes. Sorry for disinformation! :)

@nicoddemus
Copy link
Member

I guess it is ready now, right? 😄

@pfctdayelise, could you also take a look?

@Elizaveta239
Copy link
Contributor Author

Not yet, I'm going to update documentation soon :)

@@ -889,13 +892,22 @@ def parametrize(self, argnames, argvalues, indirect=False, ids=None,
if scope is None:
scope = "function"
scopenum = scopes.index(scope)
valtypes = dict.fromkeys(argnames, "funcargs")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dict.fromkeys, I didn't know that, that's cool :)

This section needs to be tidied up a bit. I think it would be simpler if you first deal with setting the right values in the valtypes dict, based on the value of indirect.
Then, secondly, go through that dict and check if we need to raise the "uses no fixture" or "fixture doesn't exist" exceptions.
Also, rather than checking if indirect is a tuple or list, it might be nicer to explicitly check for True and False, else assume it is a sequence and iterate over it.

@Elizaveta239
Copy link
Contributor Author

The fixes after code review and docs are ready :)

@pfctdayelise
Copy link
Contributor

OK @Elizaveta239 I made some changes to your branch, but now I am not sure how to get them back to you! 😟 anyway they are in 40fa7b2 (merged up to date, and fixed merge conflict in CHANGELOG) and 36b86af (added test cases).

In the test cases I added two which are failing but which should be passing. Do you want to see if you can get them passing? If not, I can do it, but you're very close to completing this :)

@Elizaveta239
Copy link
Contributor Author

@pfctdayelise Thank you! But I will not be able to do it during next two weeks :( If it's possible to wait until then -- I will fix these tests.

@pfctdayelise
Copy link
Contributor

@Elizaveta239 if it's ok with you I could fix them - it's pretty minor and I think it's better to get PRs in rather than have them lingering for ages. But if you really want to tackle them I can leave it for you :)

@Elizaveta239
Copy link
Contributor Author

@pfctdayelise Hi! I'm online again :) I added a small fix for passing your new tests and fixed one old test. But authomatic checks have failed and I can't understand why.

@RonnyPfannschmidt
Copy link
Member

@Elizaveta239 can you add another commit or perhaps even rebase to master, it seems the checks refuse to run due to automated merging isn't working in something like the changelog

# Conflicts:
#	AUTHORS
@Elizaveta239
Copy link
Contributor Author

@pfctdayelise I merged master to my branch and now authomatic checks are passed.
Also I wanted to ask you a question about links to commits you mentioned in your answer. They are shown in pytest-dev repository, but I can't find them in a history. Where are they situated?

@Elizaveta239
Copy link
Contributor Author

@RonnyPfannschmidt I merged master to my branch and it helped. Thank you! :)

@nicoddemus
Copy link
Member

They are shown in pytest-dev repository, but I can't find them in a history. Where are they situated?

I wanted to ask that as well. 😄

@pfctdayelise
Copy link
Contributor

@Elizaveta239 I think I checked out your master, but I either didn't fork it first, or the remotes are not set up correctly. So they're kind of floating around in the git ether somewhere!

@pfctdayelise
Copy link
Contributor

Is it possible to merge 36b86af into this? I don't mind even if it's done as a patch.

@RonnyPfannschmidt
Copy link
Member

@pfctdayelise just do a pull request against @Elizaveta239 's branch?

@nicoddemus
Copy link
Member

@pfctdayelise just do a pull request against @Elizaveta239 's branch?

Agree, then when @pfctdayelise merges here own branch this PR will be also merged automatically. 😊

pfctdayelise added a commit to pfctdayelise/pytest that referenced this pull request Aug 29, 2015
@pfctdayelise pfctdayelise merged commit e67d66a into pytest-dev:master Aug 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants