Message 78467 - Python tracker (original) (raw)
I think this is a good improvement, and I hope it can make it into 2.7/3.1.
Several comments on patch:
I don't like the name "SkipException" SkipTest is better IMO.
TestResult.addSkipped should be changed to TestResult.addSkip.
I'm not sure why TestResult.addSkipped gets sys.exc_info() pass in. I think you should just catch the exception and pass the reason ("str(e)") to addSkipped.
The patch needs docs before it can be applied.
As Antoine said, it would be nice to have decorators for skipping. When I implemented this, I added the skip() (unconditional skip) skip_if(condition, reason) and skip_unless(condition, reason) decorators. It should also be easy to extend the mechanism, so that custom decorators can be written.
It would nice to be able to skip whole classes, too. This could easily be done with class decorators.
(Georg, I hope you don't mind if I "steal" this from you.)