[tests] Allow tests to be skipped for unsupported features

This commit is contained in:
Dan Smith 2011-08-02 15:40:15 -07:00
parent e5b7620e06
commit da28359345

View File

@ -56,6 +56,9 @@ class TestFailedError(TestError):
def get_detail(self): def get_detail(self):
return self._detail return self._detail
class TestSkippedError(TestError):
pass
def get_tb(): def get_tb():
return traceback.format_exc() return traceback.format_exc()
@ -435,6 +438,8 @@ class TestOutputANSI(TestOutput):
msg = "\033[1;41m%s\033[0m" % msg msg = "\033[1;41m%s\033[0m" % msg
elif msg == "CRASHED": elif msg == "CRASHED":
msg = "\033[1;45m%s\033[0m" % msg msg = "\033[1;45m%s\033[0m" % msg
elif msg == "SKIPPED":
msg = "\033[1;32m%s\033[0m" % msg
TestOutput.report(self, rclass, tc, msg, e) TestOutput.report(self, rclass, tc, msg, e)
@ -473,6 +478,9 @@ td.FAILED {
td.CRASHED { td.CRASHED {
background-color: purple; background-color: purple;
} }
td.SKIPPED {
background-color: green;
}
</style> </style>
</head> </head>
<body> <body>
@ -562,6 +570,10 @@ class TestRunner:
self.report(rclass, tc, "CRASHED", e) self.report(rclass, tc, "CRASHED", e)
self.log(rclass, tc, e) self.log(rclass, tc, e)
nfailed += 1 nfailed += 1
except TestSkippedError, e:
self.report(rclass, tc, "SKIPPED", e)
self.log(rclass, tc, e)
nfailed += 1
tc.cleanup() tc.cleanup()