-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Improve test decorators #4658
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
Improve test decorators #4658
Conversation
This works:
And
Doesn't produce warnings |
How is this a better solution than what I described here? This feels very complicated in comparison to just changing the order of decorators. |
The code is wrong in python terms, we need to fix it, but I will do it with unit test so we make sure we are not introducing new bugs. |
From Gemini:
So I think this code assumes that if you do not yield in one of the exuction paths, it becomes a normal function, but actually it becomes a generator that will produce an empy list. Hence, you need two use different wrappers if you want to returns sometimes a generator and sometimes you want to return a non-generator. So a function can return some times a function that is a generator, and sometimes a function that is not a generator. But a function itself it is always either a generator or not. I found about this writing this PR: #4440 and the unit tests, allow me to see this more clearly. |
@leolara next time please just post a new comment instead of editing mine. I'm just unsure of this PR because I don't fully understand what's going on here. Instead of creating a new function, why not just change the if emit:
if out is not None:
yield from out
else:
return out |
@jtraglia I think it is ready but we should not merge without running reftests in this branch |
The reference test generator is fixed. Please test this & report back. |
Hmm this isn't right. This is for |
As by this screenshot of this link, it is: ![]() |
Ah yes. I misunderstood what the commit on the main page meant. It must be the workflow commit. ![]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The core changes look fine to me. I assume most of the new infra tests are AI generated. I skimmed them and they seem decent enough.
Fixes #4618 - Warnings when running tests
Fixes #4659 - decorator vector_test has parameter description is never used
Fixes #4661 - decorator with_config_overrides parameter emit is unnecesary
Note: we should run the reftests on this before merging.