summaryrefslogtreecommitdiff
path: root/Biz/Llamacpp.py
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2024-05-23 10:44:01 -0400
committerBen Sima <ben@bsima.me>2024-05-23 10:44:01 -0400
commit93fc94363e6aeeb7bf45cdb57af3179e66933813 (patch)
tree7eb0d68eb2f4a6f71101f12189ad903716810830 /Biz/Llamacpp.py
parentc57a7f1cb3823e5290812b30dd22a210d15c1d97 (diff)
Add test to Biz/Repl.py
It's just a simple test, but it effectively tests that the `CustomRepl` can be instantiated for the ns and path. I also copied the unittest recipes I came up with in the other place I used Python tests so far: Biz/Llamacpp.py. Also, I'm beginning to see how a Biz/Cli.py module might work. Probably just a simple abstract base class with move, test, help, and tidy methods, pretty similar to the Haskell version.
Diffstat (limited to 'Biz/Llamacpp.py')
-rw-r--r--Biz/Llamacpp.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Biz/Llamacpp.py b/Biz/Llamacpp.py
index 9a2ff86..66b57d8 100644
--- a/Biz/Llamacpp.py
+++ b/Biz/Llamacpp.py
@@ -19,14 +19,22 @@ class TestLlamaCpp(unittest.TestCase):
def test_in_path(self) -> None:
"""Test that llama.cpp is in $PATH."""
- self.assertTrue("llama-cpp" in os.environ.get("PATH", ""))
+ self.assertIn("llama-cpp", os.environ.get("PATH", ""))
+
+
+def test() -> None:
+ """Run this module's test suite."""
+ suite = unittest.TestSuite()
+ suite.addTests(
+ unittest.defaultTestLoader.loadTestsFromTestCase(TestLlamaCpp),
+ )
+ unittest.TextTestRunner().run(suite)
def main() -> None:
"""Entrypoint."""
if sys.argv[1] == "test":
- sys.argv.pop()
- unittest.main()
+ test()
else:
sys.exit(0)