5 class ResultCode(object):
6 """Test result codes."""
8 def __init__(self, name, isFailure):
10 self.isFailure = isFailure
13 return '%s%r' % (self.__class__.__name__,
14 (self.name, self.isFailure))
16 PASS = ResultCode('PASS', False)
17 XFAIL = ResultCode('XFAIL', False)
18 FAIL = ResultCode('FAIL', True)
19 XPASS = ResultCode('XPASS', True)
20 UNRESOLVED = ResultCode('UNRESOLVED', True)
21 UNSUPPORTED = ResultCode('UNSUPPORTED', False)
24 """Wrapper for the results of executing an individual test."""
26 def __init__(self, code, output, elapsed):
31 # The wall timing to execute the test, if timing.
32 self.elapsed = elapsed
37 """TestSuite - Information on a group of tests.
39 A test suite groups together a set of logically related tests.
42 def __init__(self, name, source_root, exec_root, config):
44 self.source_root = source_root
45 self.exec_root = exec_root
46 # The test suite configuration.
49 def getSourcePath(self, components):
50 return os.path.join(self.source_root, *components)
52 def getExecPath(self, components):
53 return os.path.join(self.exec_root, *components)
56 """Test - Information on a single test instance."""
58 def __init__(self, suite, path_in_suite, config):
60 self.path_in_suite = path_in_suite
62 # The test result, once complete.
65 def setResult(self, result, output, elapsed):
66 assert self.result is None, "Test result already set!"
67 self.result = Result(result, output, elapsed)
69 def getFullName(self):
70 return self.suite.config.name + ' :: ' + '/'.join(self.path_in_suite)
72 def getSourcePath(self):
73 return self.suite.getSourcePath(self.path_in_suite)
75 def getExecPath(self):
76 return self.suite.getExecPath(self.path_in_suite)