ignored test cases in unittest

Ben Finney ben+python at benfinney.id.au
Sat Aug 15 22:15:04 EDT 2009


Terry <terry.yinzhe at gmail.com> writes:

> It seemed the to me that python unittest module does not support the
> counting of ignored test cases directly. Is there any ready solution
> for this?

One solution I've seen involves:

* a custom exception class, ‘TestSkipped’

* raising that exception at the top of test cases you want to
  temporarily skip

* a custom ‘TestResult’ class that knows about a “skipped” result

* a custom reporter class that knows how you want to report that result

-- 
 \       “A lot of people are afraid of heights. Not me, I'm afraid of |
  `\                                           widths.” —Steven Wright |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list