Author rblank
Date 2004-09-30.09:37:42
SpamBayes Score
Marked as misclassified
Logged In: YES 

I strongly disagree. Skipped tests should not just be
transformed into passed tests, but must be recorded as
skipped and reported to the user. Knowing that a test
skipped is important information.

The Python regression tests (although I'm not familiar with
them) provide the same "skip" functionality, and I don't
think people would be happy to replace it with just "pass".

The decorator approach is an interesting idea, though, and
could be combined with skipIf() so as to provide the other
advantages you mention, namely single definition and
appearance prior to definition. Something along the following:

def rootOnly(f):
        """Decorator to skip tests that require root access"""
        def wrapper(self):
                self.skipIf(os.getuid() != 0, "Must be root")
        wrapper.__doc__ = f.__doc__
        return wrapper

class ReadShadowTest(unittest.TestCase):
        """Read access to /etc/shadow"""
        def testReadingAsRoot(self):
                """Reading /etc/shadow as root"""

Note that I'm not yet familiar with decorators, so the
wrapper() function might not be the correct way to do this.
Date User Action Args
2007-08-23 15:39:54adminlinkissue1034053 messages
2007-08-23 15:39:54admincreate