def save_log_files(): log_storage = Path(cm.workspace + "/" + LOG_STORAGE) if not Path.exists(log_storage): Path(log_storage).mkdir(parents=True, exist_ok=True) log_file_paths = ARTIFACT_REPORTS_PATHS if log_file_paths: for file in log_file_paths: absolute_file_path = Path(cm.workspace + "/" + cm.product_id + "/" + file) if Path.exists(absolute_file_path): cm.copy_file(absolute_file_path, log_storage) else: logger.error("File doesn't contain in the given location: " + str(absolute_file_path))
def save_test_output(): report_folder = Path(cm.workspace + "/" + TEST_OUTPUT_DIR_NAME) if Path.exists(report_folder): shutil.rmtree(report_folder) report_file_paths = ARTIFACT_REPORTS_PATHS for key, value in report_file_paths.items(): for file in value: absolute_file_path = Path(cm.workspace + "/" + cm.product_id + "/" + file) if Path.exists(absolute_file_path): report_storage = Path(cm.workspace + "/" + TEST_OUTPUT_DIR_NAME + "/" + key) cm.copy_file(absolute_file_path, report_storage) logger.info("Report successfully copied") else: logger.error("File doesn't contain in the given location: " + str(absolute_file_path))