-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Show repr() of exceptions passed to @parametrize #351
Comments
Original comment by Brianna Laugher (BitBucket: pfctdayelise, GitHub: pfctdayelise): @ssssam where is the patch? I don't see an attachment... |
Original comment by Sam Thursfield (BitBucket: samthursfield, GitHub: samthursfield): You're correct! Sorry. I've just tried to attach it again, but bitbucket sends me to a blank page and doesn't seem to actually attach the patch. I've put in pastebin instead here: http://pastebin.com/jVE2bagb |
Original comment by Brianna Laugher (BitBucket: pfctdayelise, GitHub: pfctdayelise): So...this will work, but there are a kind of unending number of classes which might be appropriate to add here. Some classes might be better with str, some might be better with repr. And for individuals working in their own codebases it would be nice to add their relevant classes as well. It is possible to make a plugin to modify the ids as you prefer, but it means repeating all the code in Metafunc.parametrize, which is not very sustainable. Better options might be:
I would probably lean towards the latter, thoughts, @hpk42 ? |
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42): I agree with @pfctdayelise on that the patch is not generic enough. And i tend to rather prefer the option one that she suggests, after which the original example would look like this:
|
Original comment by Sam Thursfield (BitBucket: samthursfield, GitHub: samthursfield): Thanks for the feedback! Allowing Sadly I'm not working with py.test right now so I don't think I'll get time to come up with another patch. I'm happy if you want to close the issue for now. |
Originally reported by: Sam Thursfield (BitBucket: ssssam, GitHub: ssssam)
I have a number of test cases that test raising and handling exceptions, and I use @parametrize for this as follows:
It would be nice if Py.test automatically included the exception names in the test names so that I didn't need the extra 'ids' parameter. I've attached an initial attempt at a patch that makes this happen.
The text was updated successfully, but these errors were encountered: