def save_testcase(self, testcase):
"""
Save all testcases collected during monitoring
"""
try:
if self.config.debug:
print("[\033[92mINFO\033[0m] Saving testcase...")
dir_name = "testcase_{0}".format(os.path.basename(shlex.split(self.config.process_to_monitor)[0]))
try:
os.mkdir(dir_name)
except OSError:
pass
for test in testcase:
with open("{0}/testcase_{1}.json".format(dir_name, self.testcase_count), "wb") as t:
t.write(test)
t.close()
self.testcase_count += 1
except Exception as e:
raise PJFBaseException(e.message if hasattr(e, "message") else str(e))
评论列表
文章目录