diff options
author | Alec Warner <antarus@gentoo.org> | 2007-03-07 04:27:18 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2007-03-07 04:27:18 +0000 |
commit | f4eadc536e93cc9f429d249989a61b019c82d6bb (patch) | |
tree | 9404c0328ea1ef6ec05fad5ae1288efd69629cb4 | |
parent | 12215e7324eac090564508642c779208f12795c4 (diff) | |
download | portage-f4eadc536e93cc9f429d249989a61b019c82d6bb.tar.gz portage-f4eadc536e93cc9f429d249989a61b019c82d6bb.tar.bz2 portage-f4eadc536e93cc9f429d249989a61b019c82d6bb.zip |
Take marien's advice, turn Skips into Todos for clarity sake
svn path=/main/trunk/; revision=6189
-rw-r--r-- | pym/portage/tests/__init__.py | 29 | ||||
-rw-r--r-- | pym/portage/tests/dep/test_isvalidatom.py | 3 |
2 files changed, 14 insertions, 18 deletions
diff --git a/pym/portage/tests/__init__.py b/pym/portage/tests/__init__.py index 56fc869c2..159e67b63 100644 --- a/pym/portage/tests/__init__.py +++ b/pym/portage/tests/__init__.py @@ -46,27 +46,23 @@ def getTests( path, base_path ): raise return result -class SkipException(Exception): - pass - class TextTestResult(unittest._TextTestResult): """ - We need a subclass of unittest._TextTestResult to handle skipped - tests. + We need a subclass of unittest._TextTestResult to handle tests with TODO - This just adds an addSkip method that can be used to add - skipped tests to the result; these can be displayed later + This just adds an addTodo method that can be used to add tests + that are marked TODO; these can be displayed later by the test runner. """ def __init__( self, stream, descriptions, verbosity ): unittest._TextTestResult.__init__( self, stream, descriptions, verbosity ) - self.skipped = [] + self.todoed = [] - def addSkip( self, test, info ): - self.skipped.append((test,info)) + def addTodo( self, test, info ): + self.todoed.append((test,info)) if self.showAll: - self.stream.writeln("FAIL AND SKIP") + self.stream.writeln("TODO") elif self.dots: self.stream.write(".") @@ -75,7 +71,7 @@ class TextTestResult(unittest._TextTestResult): self.stream.writeln() self.printErrorList('ERROR', self.errors) self.printErrorList('FAIL', self.failures) - self.printErrorList('SKIP', self.skipped) + self.printErrorList('TODO', self.todoed) class TestCase(unittest.TestCase): """ @@ -85,8 +81,6 @@ class TestCase(unittest.TestCase): (broken code!!??!11oneone) but it does happen at times. """ - SkipException = SkipException - def __init__(self, methodName='runTest'): # This method exists because unittest.py in python 2.4 stores # the methodName as __testMethodName while 2.5 uses @@ -114,9 +108,10 @@ class TestCase(unittest.TestCase): testMethod() ok = True except self.failureException: - result.addFailure(self, self._exc_info()) - except self.SkipException: - result.addSkip(self,"%s: Failed but Skippable" % testMethod) + if self.todo: + result.addTodo(self,"%s: TODO" % testMethod) + else: + result.addFailure(self, self._exc_info()) except KeyboardInterrupt: raise except: diff --git a/pym/portage/tests/dep/test_isvalidatom.py b/pym/portage/tests/dep/test_isvalidatom.py index 5f0149120..35f7160b7 100644 --- a/pym/portage/tests/dep/test_isvalidatom.py +++ b/pym/portage/tests/dep/test_isvalidatom.py @@ -12,6 +12,8 @@ class IsValidAtom(TestCase): """ A simple testcase for isvalidatom """ + todo = True + def testIsValidAtom(self): tests = [ ( "sys-apps/portage", True ), @@ -33,7 +35,6 @@ class IsValidAtom(TestCase): ( "portage", False ) ] for test in tests: - raise self.SkipException() if test[1]: atom_type = "valid" else: |