how to skip a unittest case in python 2.6

python, unit-testing

Solution

Use `unittest2`.

The following code imports the right `unittest` in a manner transparent to the rest of your code:

import sys
if sys.version_info < (2, 7):
    import unittest2 as unittest
else:
    import unittest

Problem

`unittest.skip*` decorators and methods as below (see here for more details) were added since python2.7 and i found they are quite useful. ``` unittest.skip(reason) unittest.skipIf(condition, reason) unittest.skipUnless(condition, reason) ``` However, my question is how we should do the similar if working with python2.6?

Original source