-
Notifications
You must be signed in to change notification settings - Fork 40
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
Can't run function/method that uses parametrization #23
Comments
On first look, this seems to be a bug on And trying to replicate this, the first thing I tried was to point Did you find a way to run that specific test function from the command line using that |
Aha! so, In a
Each of those functions is a node defining its own id with a changed name. And I am able to run a single of those by specifying it like:
I will have to open an issue on the |
Opened an issue on py.test tracker: https://bitbucket.org/hpk42/pytest/issue/649/parametrized-test-nodes-cannot-be |
Would it be possible to select the test based on a substring match? http://pytest.org/latest/example/markers.html#using-k-expr-to-select-tests-based-on-their-name |
Yeah, it seems like a combination of both will do the trick. This will take a bit of effort to put together though :( We need to correctly detect if we are dealing with a method or function so we can use as much information as possible and avoid selecting more than one test (which can happen with |
@sloria I just pushed an attempt to support this, and I was able to run parametrized functions and methods (including your test example). However, and specifically for functions, this may cause more tests to run than desired if for example, you have a test function called Since Would you mind trying the https://github.com/alfredodeza/pytest.vim/tree/issue23 branch and test it out? |
Thanks for the patch. I will try it tomorrow when I have some free time. |
@alfredodeza The patch works as expected. I was able to run parametrized tests, but tests whose names begin with the same substring also run. For me, this is fine for the time being until the pytest issue you reported is addressed; better to have too many tests run than none. =) |
To amend my previous comment: I ended up reverting back to Hopefully there's a better solution that doesn't add too much complexity. |
Even though that is the case for you, I think this plugin should still try to work with parametrized tests vs. not handling them at all. I will merge this into master shortly unless you have strong opinion against it? I've been bit by this problem before and I rather have a few extra tests run (in the worse case scenario) than just a generic error. |
@alfredodeza I think it is fine to merge. I have no strong opinion either way. |
If I did a pip install --upgrade will I be able to see the bug fixed, I'm currently experiencing the same issue |
@asafpelegcodes this issue is from py.test issue is here: https://bitbucket.org/hpk42/pytest/issue/649/parametrized-test-nodes-cannot-be |
Thanks Alfredo, I just commented on the bitbucket bug as well to note that On Fri, Jan 23, 2015 at 4:43 PM, Alfredo Deza notifications@github.com
|
To reproduce:
Given the following code:
Executing
:Pytest function verbose
results in the following error.Note:
:Pytest file
works fine. However, it'd be very nice to run paramerized test functions and methods in isolation.The text was updated successfully, but these errors were encountered: