Files
linux-packaging-mono/external/llvm/utils/lit/lit/LitTestCase.py
Xamarin Public Jenkins (auto-signing) 64ac736ec5 Imported Upstream version 6.0.0.172
Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
2019-04-12 14:10:50 +00:00

35 lines
850 B
Python

from __future__ import absolute_import
import unittest
import lit.Test
"""
TestCase adaptor for providing a 'unittest' compatible interface to 'lit' tests.
"""
class UnresolvedError(RuntimeError):
pass
class LitTestCase(unittest.TestCase):
def __init__(self, test, run):
unittest.TestCase.__init__(self)
self._test = test
self._run = run
def id(self):
return self._test.getFullName()
def shortDescription(self):
return self._test.getFullName()
def runTest(self):
# Run the test.
self._run.execute_test(self._test)
# Adapt the result to unittest.
result = self._test.result
if result.code is lit.Test.UNRESOLVED:
raise UnresolvedError(result.output)
elif result.code.isFailure:
self.fail(result.output)