You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
570 B

  1. import os
  2. import sys
  3. import unittest
  4. import tempfile
  5. samples_dir = os.path.join(sys.path[0], "sample_configs")
  6. CONFIG_FILES = list(os.path.join(samples_dir, file) for file in os.listdir(samples_dir))
  7. class ReadWriteTest(unittest.TestCase):
  8. def setUp(self):
  9. self.write_file = tempfile.TemporaryFile(mode="r+")
  10. def tearDown(self):
  11. self.write_file.close()
  12. class TestTempFile(ReadWriteTest):
  13. def test_me(self):
  14. self.write_file.write("hello")
  15. self.write_file.seek(0)
  16. self.assertEqual(self.write_file.read(), "hello")