aboutsummaryrefslogtreecommitdiff
path: root/test/test_general.py
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-06-18 00:08:54 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-06-25 00:15:17 +0200
commit0f5581f53f73a92d33826c4771553a9683376e67 (patch)
treeeab8172d21dc4a0b36714af541d22a82cec858f3 /test/test_general.py
parent00a0cb3821ce2bd0fc589ae64ed9cbb791ce44bb (diff)
Adds unit testing scaffold and build tests
Diffstat (limited to 'test/test_general.py')
-rw-r--r--test/test_general.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test_general.py b/test/test_general.py
new file mode 100644
index 0000000..eb3185d
--- /dev/null
+++ b/test/test_general.py
@@ -0,0 +1,31 @@
+import subprocess
+import unittest
+
+from tempfile import TemporaryDirectory
+
+class SalisTest(unittest.TestCase):
+ def setUp(self):
+ self.tempdir = TemporaryDirectory(prefix="salis_test_")
+
+ def tearDown(self):
+ self.tempdir.cleanup()
+
+ @staticmethod
+ def run_subprocess(cmd):
+ subprocess.run(cmd.split(), check=True, stdout=subprocess.DEVNULL)
+
+ @staticmethod
+ def run_pipe(cmd):
+ return subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, text=True)
+
+ @staticmethod
+ def run_ui_test(anc, anc_path, ui, ui_path, vm_arch, clones=1, cores=1, name="def.sim"):
+ def test_decorator(test_case):
+ def test_wrapper(self):
+ cmd = f"./salis.py new -a{anc} -A{anc_path} -C{clones} -c{cores} -H{self.tempdir.name} -n{name} -u{ui} -U{ui_path} -v{vm_arch}"
+ subprocess.run(cmd.split(), check=True, stdout=subprocess.DEVNULL)
+ test_case(self)
+
+ return test_wrapper
+
+ return test_decorator