Skip to content
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

unittest: Always use "raise" with an argument. #937

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

dpgeorge
Copy link
Member

So this code can be compiled with the MicroPython native emitter, which does not support "raise" without any arguments.

So this code can be compiled with the MicroPython native emitter, which
does not support "raise" without any arguments.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge requested a review from andrewleech November 18, 2024 01:01
Copy link
Contributor

@andrewleech andrewleech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I wasn't aware of that with the native emitter, I'll keep that in mind for other things in future.

Regardless yes this is a straightforward change that does not change the intent of the functions at all.

It does highlight some slight style inconsistencies in the package already (e, ex) but that doesn't change the function and it's clearer to keep this change minimal.

@dpgeorge
Copy link
Member Author

Thanks for the review!

Oh I wasn't aware of that with the native emitter, I'll keep that in mind for other things in future.

I try to stay away from raise without args, which will be hard to make it work (efficiently) with the native emitter (need to store the current exception somewhere).

I bumped into this issue for micropython/micropython#16216

@dpgeorge dpgeorge merged commit e4cf095 into micropython:master Nov 19, 2024
4 checks passed
@dpgeorge dpgeorge deleted the unittest-raise-with-arg branch November 19, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants