-
Notifications
You must be signed in to change notification settings - Fork 134
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
Fix for silent plugin failures. #199
Conversation
Code slightly cleaner and stacktrace only logged if -v is passed to nose2. I'm now also considering adding some early flight checks in the junitxml plugin, to make the error slightly more explicit. |
If an unexpected exception occurs I prefer nose2 to halt (but gracefully so print the error, log it and I hope that make sense. If you feel differently, you can convince me. I'm not entirely sure what's right so I'm currently -0 on this PR. |
Thanks, I'm OK with terminating gracefully as well. |
So I updated nose2 to abort if an exception is caught. I also moved the error handling code into main.py instead of events.py, as calling sys.exit made more sense there. It also reverts events.py's Hook class to the original implementation from unitest2's plugins branch. |
Just a quick ping... is everything OK with the new patch? |
Sorry, I was very busy. |
No problem! |
@aloysbaillet Yes please. aloysbaillet@a852477 fixes #159. |
Fix for silent plugin failures.
This change adds a junitxml functional test that tries to create a xml report in a folder that doesn't exist.
The IO error was not being propagated to the user, so I added a log.exception (that appears in the logging stream in stdout), and a more compact stderr message.
An important side-effect of this change is that now any plugin failure will not stop nose from continuing. I believe this is good as it prevents a bad plugin from breaking the test process, but this could be sometimes bad, in the case of an early failure that should really prevent anything else from happening... that said it looks like I haven't broken anything at this stage.
I'm happy to revisit the error messages, or maybe use log.debug('...', exc_info=True) to only display the stacktrace when -v is passed to nose, looking for feedback on this.
This fixes #159.