-
Notifications
You must be signed in to change notification settings - Fork 7
Handle Exception in teardown #18
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
base: master
Are you sure you want to change the base?
Conversation
unittest2.nim
Outdated
if stackTraces.len > 0: | ||
echo stackTraces[i] |
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.
This is not related to the fix, but IMHO it is more intuitive to see first the exception and then the stacktrace.
Master is also failing with nim 1.7.3 |
3cd0b33
to
a0cb008
Compare
somehow this patch breaks parallel test randomly |
@jangko Could you please suggest a simple way to reproduce it? |
I only see it in the CI, not locally |
This job seems to be failing for a similar reason https://github.com/status-im/nim-unittest2/actions/runs/4204629692/jobs/7295560458. @Menduist |
I'm seeing the same breakage in another PR that cannot be the root cause - I suspect it's a bad test more than anything else |
a22c5fa
to
d90f33e
Compare
@arnetheduck could you please review the last version, not sure that's how the tests are supposed to look now. |
Motivation
When a test fails (either because of a bug in the code or because the developer intentionally caused the error to see if the test fails as expected) we should see the error that happened inside the test code, but currently, if an error also happens inside the teardown (potentially because of the previous error) the original error is swallowed and not shown.
This is a beginner's attempt to improve error handling.