blob: 71ac32aca9190721d354c92b1e2a20fca5435c59 (
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
|
"""Test runner and related functions."""
import logging
import Omni.App as App
import Omni.Log as Log
import typing
import unittest
TestCase = unittest.TestCase
class TestError(Exception):
"""When the test environment or harness encounters a problem."""
def run(area: App.Area, tests: list[typing.Any]) -> None:
"""Run the given tests with loglevel determined by area."""
logger = logging.getLogger(__name__)
Log.setup(logger, logging.DEBUG if area == App.Area.Test else logging.ERROR)
suite = unittest.TestSuite()
suite.addTests([
unittest.defaultTestLoader.loadTestsFromTestCase(tc) for tc in tests
])
unittest.TextTestRunner(verbosity=2).run(suite)
|