-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
pytest.skip in pytest_itemcollected hook raises INTERNALERROR #3219
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
Have you tried testing your code with the latest pytest version? Please provide a minimal example. |
With attached example.zip:
If you comment
|
Do you really need to "skip" tests, or would it be possible to "deselect" them ? |
I have scenario where test need to be skipped, and i cant just mark them, because skip decision is a bit more complex than in attached example. |
Would it be possible if you deselect the tests in |
Regarding As I wrote, i have workaround for my case, so question is just do you see internalerror as a bug or not? |
Regarding my question about |
for this issue - using skip in that hook is a programmer error, i consider it perfectly valid for pytest to fall over there - a skip happens in a test execution - the but where the code is at is test selection |
Should we close this then? |
i believe so, but i'd like to hear back from @bechaos first |
I dont understand why is using |
Makes sense, but why I wonder it works with |
hmm, if it works, then we are likely looking at a bug in pytest there, it shouldnt |
It might be sufficient to just mention in the docs that |
Is |
@ceridwen currently it works: import pytest
@pytest.fixture(params=[pytest.mark.skip('foo')(1), 2, 3])
def fix(request):
pass
def test(fix):
pass
def test2():
pass
|
I just wondering if it's going to continue to work in the future. Actually, I should say, it usually works. I haven't been able to put together a minimal example for it yet, but I've been using |
Actually string-expression are evaluated using the globals available where the test function executes, here's the related code: Lines 110 to 114 in 3909225
This might explain why it works in some cases ( That's one of the reasons why using a boolean is preferred than string expressions, see string conditions in the docs. |
That explains it. Naturally, in my use-case it has to be in |
@ceridwen in that case try using |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I have tried to find anything in documentation about hooks and skip, but i was not able to. Calling
pytest.skip
in other hooks e.g.pytest_runtest_call
,pytest_generate_tests
orpytest_runtest_setup
skips item fine.However when called in
pytest_itemcollected
i get:Thank you for your time.
The text was updated successfully, but these errors were encountered: