Message46935
Logged In: YES
user_id=568100
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")
self.f()
wrapper.__doc__ = f.__doc__
return wrapper
class ReadShadowTest(unittest.TestCase):
"""Read access to /etc/shadow"""
@rootOnly
def testReadingAsRoot(self):
"""Reading /etc/shadow as root"""
open("/etc/shadow").close()
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:54 | admin | link | issue1034053 messages |
2007-08-23 15:39:54 | admin | create | |
|