From 30311917c2c804dcd4b22c3c77efc92c6a09a6a9 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Sun, 17 Nov 2019 22:38:05 -0600 Subject: [PATCH] starting to migrate to the unittest module --- tests/tests.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/tests.py diff --git a/tests/tests.py b/tests/tests.py new file mode 100644 index 0000000..32dfcc5 --- /dev/null +++ b/tests/tests.py @@ -0,0 +1,22 @@ +import os +import sys +import unittest +import tempfile + +samples_dir = os.path.join(sys.path[0], "sample_configs") +CONFIG_FILES = list(os.path.join(samples_dir, file) for file in os.listdir(samples_dir)) + + +class ReadWriteTest(unittest.TestCase): + def setUp(self): + self.write_file = tempfile.TemporaryFile(mode="r+") + + def tearDown(self): + self.write_file.close() + + +class TestTempFile(ReadWriteTest): + def test_me(self): + self.write_file.write("hello") + self.write_file.seek(0) + self.assertEqual(self.write_file.read(), "hello")