summaryrefslogtreecommitdiff
path: root/Omni/Test.py
blob: 495334a0bcc4ed2f5d7d1a2bad3100dbcda62c03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""Test runner and related functions."""

import logging
import Omni.App as App
import Omni.Log as Log
import typing
import unittest


def run(area: App.Area, tests: list[typing.Any]) -> None:
    """Run the given tests with loglevel determined by area."""
    Log.setup(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)