def create_config_files(): global_temp = autotemp.tempfile("global", ".ini", text=True) os.write(global_temp.fd, settings_ini_contents) shadow_temp = autotemp.tempfile("shadow", ".ini", text=True) fd = shadow_temp.fd os.write(shadow_temp.fd, shadow_config_ini_contents) return (global_temp, shadow_temp)
def test_clean(self): temp = autotemp.tempfile(unique_id='clean') # clean up sets name to None so we preserve it this way name = temp.name self.assertTrue(os.path.exists(name)) temp.clean() self.assertFalse(os.path.exists(name))
def create_file(content): file_temp = autotemp.tempfile(unique_id='cli_mock', text=True) os.write(file_temp.fd, content) return file_temp
def test_del(self): tmp_file = autotemp.tempfile(unique_id='del') name = tmp_file.name self.assertTrue(os.path.exists(name)) tmp_file.__del__() self.assertFalse(os.path.exists(name))
def test_create_file(self): temp = autotemp.tempfile(unique_id='file') self.assertTrue(os.path.exists(temp.name))
def setUp(self): self.control_tmp = autotemp.tempfile(unique_id='control_unit', text=True) os.write(self.control_tmp.fd, CONTROL)