From 9e97dd4300cf08a68c155d126208e8d0e163b906 Mon Sep 17 00:00:00 2001 From: MiniFrenchBread <103425574+MiniFrenchBread@users.noreply.github.com> Date: Thu, 6 Jun 2024 20:26:57 +0800 Subject: [PATCH] fix: test --- tests/test_framework/test_framework.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_framework/test_framework.py b/tests/test_framework/test_framework.py index 06f8a33..05e53fc 100644 --- a/tests/test_framework/test_framework.py +++ b/tests/test_framework/test_framework.py @@ -4,6 +4,7 @@ import logging import os import pdb import random +import re import shutil import subprocess import sys @@ -381,8 +382,10 @@ class TestFramework: line = line.decode("utf-8") self.log.debug("line: %s", line) if "root" in line: - index = line.find("root=") - root = line[index + 5 : -1] + filtered_line = re.sub(r'\x1b\[([0-9,A-Z]{1,2}(;[0-9]{1,2})?(;[0-9]{3})?)?[m|K]?', '', line) + index = filtered_line.find("root=") + if index > 0: + root = filtered_line[index + 5 : index + 5 + 66] except Exception as ex: self.log.error("Failed to upload file via CLI tool, output: %s", output_name) raise ex