summaryrefslogtreecommitdiff
path: root/test/test_general.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_general.py')
-rw-r--r--test/test_general.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/test_general.py b/test/test_general.py
new file mode 100644
index 0000000..b4e0e85
--- /dev/null
+++ b/test/test_general.py
@@ -0,0 +1,54 @@
+# file : test/test_general.py
+# project : Salis-VM
+# author : Paul Oliver <contact@pauloliver.dev>
+
+# index:
+# [section] imports
+# [section] setup/teardown
+# [section] file lists
+# [section] assertions
+# [section] subprocess
+
+# ------------------------------------------------------------------------------
+# [section] imports
+# ------------------------------------------------------------------------------
+import os
+import subprocess
+import unittest
+
+from tempfile import TemporaryDirectory
+
+class SalisTest(unittest.TestCase):
+ # --------------------------------------------------------------------------
+ # [section] setup/teardown
+ # --------------------------------------------------------------------------
+ def setUp(self):
+ self.tempdir = TemporaryDirectory(prefix="salis_test_")
+
+ def tearDown(self):
+ self.tempdir.cleanup()
+
+ # --------------------------------------------------------------------------
+ # [section] file lists
+ # --------------------------------------------------------------------------
+ def files_on_new(self, name):
+ return [
+ f"{self.tempdir.name}/{name}/evas/evas-{0:016x}",
+ f"{self.tempdir.name}/{name}/opts.json",
+ f"{self.tempdir.name}/{name}/{name}",
+ f"{self.tempdir.name}/{name}/{name}-{0:016x}",
+ f"{self.tempdir.name}/{name}/{name}.sqlite3",
+ ]
+
+ # --------------------------------------------------------------------------
+ # [section] assertions
+ # --------------------------------------------------------------------------
+ def assert_files_exist(self, files):
+ for file in files:
+ assert os.path.isfile(file), f"{file} does not exist"
+
+ # --------------------------------------------------------------------------
+ # [section] subprocess
+ # --------------------------------------------------------------------------
+ def run_subprocess(self, command):
+ subprocess.run(command.split(), check=True, stdout=subprocess.DEVNULL)