-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Simplify running parametrized tests by node ID #1360
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
Comments
that feature is in the list its currently unreliable to implement due to collection being misshaped, |
would acceptable alternative solution to your case be to give the randomized item a hardcoded id, so the test name is |
I too was bitten by this limitation. The documentation here clearly states that:
I would have expected doing py.test test_mod.py::TestClass::test_method to run the parametrized test with all the parameters. |
Also, the scheme used by shapiy to access the first parametrized parameter 'date' (if I understand correctly) doesn't seem to work for every object type. For example, this works with
But the following doesn't (it returns:
And what happens when a parametrized test takes multiple parameters? I don't think the current scheme of appending the parametrized iteration to the parameter name makes much sense. What I would like to be able to do would rather be:
|
@Apteryks I agree with your points... I'm not sure how easy it is to support them under the current architecture though. |
@Apteryks @shapiy As a workaround for now you guys might find pytest-interactive handy. I originally tossed it together to accommodate making more complex selections of dynamically generated tests from the cli. It's been on the back burner for far too long and I've been meaning to write tests for it as required by plugincompat before throwing it up on PyPI. The whole idea is to select tests after all test gen is complete using |
@tgoodlet, thank you for letting us know about this project of yours, it does seem very promising! I'll be trying it soon :) |
This does work these days (although it's implemented with a hack). |
Please consider such a case. Contents of test_mod.py:
So, to run the particular test method, I need to call the command:
But if there are two parameter values, it's not gonna work. Also, I need to keep in mind how parameters of different types are mapped to ID parts. Currently I do this:
But it would be really nice to run the method (including all parameters) simply by truncating the square brackets:
The text was updated successfully, but these errors were encountered: