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=None):
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):
66 if self.result is not None:
67 raise ArgumentError("test result already set")
68 if not isinstance(result, Result):
69 raise ArgumentError("unexpected result type")
73 def getFullName(self):
74 return self.suite.config.name + ' :: ' + '/'.join(self.path_in_suite)
76 def getSourcePath(self):
77 return self.suite.getSourcePath(self.path_in_suite)
79 def getExecPath(self):
80 return self.suite.getExecPath(self.path_in_suite)