blob: 89511858435713090a7d69edce180a0590bdaee1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import unittest
import Test
"""
TestCase adaptor for providing a 'unittest' compatible interface to 'lit' tests.
"""
class UnresolvedError(RuntimeError):
pass
class LitTestCase(unittest.TestCase):
def __init__(self, test, lit_config):
unittest.TestCase.__init__(self)
self._test = test
self._lit_config = lit_config
def id(self):
return self._test.getFullName()
def shortDescription(self):
return self._test.getFullName()
def runTest(self):
tr, output = self._test.config.test_format.execute(
self._test, self._lit_config)
if tr is Test.UNRESOLVED:
raise UnresolvedError(output)
elif tr.isFailure:
self.fail(output)
|