mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-13 08:35:46 +00:00
use with Python's unittest. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99498 91177308-0d34-0410-b5e6-96231b3b80d8
31 lines
751 B
Python
31 lines
751 B
Python
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)
|