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.
|
|
import osimport sysimport unittestimport 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")
|