Browse Source

starting to migrate to the unittest module

neo
Raphael Roberts 6 years ago
parent
commit
30311917c2
  1. 22
      tests/tests.py

22
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")
Loading…
Cancel
Save