-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
parametrize: allow ellipsis to avoid repeating argument list? #518
Comments
Original comment by Matthias Geier (BitBucket: geier, GitHub: geier): My patch doesn't work if the number of arguments is 1.
|
Original comment by Matthias Geier (BitBucket: geier, GitHub: geier): I found out that this issue is a duplicate of #94, which is marked "wontfix". However, in my proposal, arbitrary other fixtures can be used in the argument list, they only have to be in the end of the list. My concrete use case for this feature would be to have a dictionary of test cases and one test function that is parametrized with this dictionary. Of course I could also just pass the tuples as a single argument, but then I would loose the very helpful display of argument names in case of a test failure. |
I'm the author of this issue, @pytestbot didn't realize that I have a different user name on bitbucket and github. |
Closing this as it's been handled in #780 |
Originally reported by: Matthias Geier (BitBucket: geier, GitHub: geier)
I'm new to py.test, so please forgive me if this is nonsense ...
I really like py.test and especially the parametrize-feature but I found it gets a bit tedious if I have many arguments in my test function.
The problem is that I basically have to repeat the whole list of arguments: I have to write them once in the string-argument to the
parametrize
decorator and then again in the argument list of the test function itself.Here's an example:
I thought it would be nice if the decorator could automatically deduce the list of arguments from the test function, like this:
In Python 2.x, you'd have to use
Ellipsis
instead of...
, of course.I tried to implement this and came up with a little patch:
I'm sorry that I didn't make a pull request, but I have no clue about Mercurial.
But I guess the change is small enough.
Fixture arguments to the test function do still work, but now they have to be in the end of the argument list, e.g.:
What do you think of this idea?
Has something like this been discussed already?
The text was updated successfully, but these errors were encountered: