summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBiz/Storybook.py9
-rw-r--r--Omni/Test.py17
2 files changed, 19 insertions, 7 deletions
diff --git a/Biz/Storybook.py b/Biz/Storybook.py
index 253cf3b..7d8f326 100755
--- a/Biz/Storybook.py
+++ b/Biz/Storybook.py
@@ -32,6 +32,7 @@ import ludic.catalog.typography as typography
import ludic.web
import Omni.App as App
import Omni.Log as Log
+import Omni.Test as Test
import openai
import os
import pathlib
@@ -78,13 +79,7 @@ def move(area: App.Area) -> None:
def test(area: App.Area = App.Area.Test) -> None:
"""Run the unittest suite manually."""
- Log.setup(logging.DEBUG if area == App.Area.Test else logging.ERROR)
- suite = unittest.TestSuite()
- tests = [IndexTest, StoryTest]
- suite.addTests([
- unittest.defaultTestLoader.loadTestsFromTestCase(tc) for tc in tests
- ])
- unittest.TextTestRunner(verbosity=2).run(suite)
+ Test.run(area, [IndexTest, StoryTest])
def const(s: str) -> str:
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)