def write_to_temp(self, file, content): temp_dir = os.path.join(settings.PROJECT_DIR, "temp") os.makedirs_p(temp_dir) temp_file = os.path.join(temp_dir, file) os.touch(temp_file) f = open(temp_file, "w") f.write(content) return temp_file
def extract_tar(self, tar_file, dest_dir): if os.path.exists(dest_dir): os.makedirs_p(dest_dir) if not os.path.exists(tar_file): raise Exception("i cannot find the tar file.") tar = tarfile.open(tar_file) tar.extractall(dest_dir) tar.close()
def testShouldReturnFalseIfAnyResultJsonIsMissing(self): project1 = self.config.result_dir() os.makedirs_p(project1) os.touch(os.path.join(project1, 'pass_rate.txt')) self.assertEquals(False, self.config.has_result())