summaryrefslogtreecommitdiffstats
path: root/pym/portage/tests/__init__.py
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2007-03-07 04:27:18 +0000
committerAlec Warner <antarus@gentoo.org>2007-03-07 04:27:18 +0000
commitf4eadc536e93cc9f429d249989a61b019c82d6bb (patch)
tree9404c0328ea1ef6ec05fad5ae1288efd69629cb4 /pym/portage/tests/__init__.py
parent12215e7324eac090564508642c779208f12795c4 (diff)
downloadportage-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
Diffstat (limited to 'pym/portage/tests/__init__.py')
-rw-r--r--pym/portage/tests/__init__.py29
1 files changed, 12 insertions, 17 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: