summaryrefslogtreecommitdiff
path: root/Omni/Test.py
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-01-21 04:25:32 -0500
committerBen Sima <ben@bsima.me>2025-01-21 05:05:18 -0500
commitfd1942057642098d0ec2878586d33e9c79483848 (patch)
treeae8ed68c547c01f012459676525355a48e4bee03 /Omni/Test.py
parent7408e658a811a5431c1916d07836fbe29adeea96 (diff)
Move test runner to Omni/Test.py
Like the previous commit, this matches Omni/Test.hs.
Diffstat (limited to 'Omni/Test.py')
-rw-r--r--Omni/Test.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Omni/Test.py b/Omni/Test.py
new file mode 100644
index 0000000..495334a
--- /dev/null
+++ b/Omni/Test.py
@@ -0,0 +1,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)