On Aug 16, 5:25 pm, Duncan Booth <duncan.bo...@invalid.invalid> wrote: > Ben Finney <ben+pyt...@benfinney.id.au> wrote: > > Terry <terry.yin...@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 > > I'd add to that a decorator so you can quickly mark a test case as ignored > without editing the test itself. Also you could include a reason why it is > ignored: > > �...@ignore("This test takes too long to run") > def test_foo(self): > ... > > That also means you can redefine the decorator easily if you want to try > running all the ignored tests. > > Another decorator useful here is one that asserts that the test will fail. > If the test passes then maybe someone fixed whatever was making it fail and > if so you want to consider re-enabling it. > > �...@fails("Needs the frobnozz module to be updated") > def test_whotsit(self): > ...
Thanks for the solutions. I think the decorator idea is what I'm look for:-) -- http://mail.python.org/mailman/listinfo/python-list