优化日志输出,增加时间分界线

This commit is contained in:
fumingwei
2020-05-28 19:53:12 +08:00
parent 3ed7d896a6
commit 6c939825e7

View File

@@ -392,10 +392,9 @@ if __name__ == '__main__':
lognewestpath = "/root/result_self_test/unittest/unittest_result.log.newest"
with open(lognewestpath,"w+") as f:
runner = unittest.TextTestRunner(stream=f,verbosity=2)
f.write("Test start time: ")
f.write(time.asctime(time.localtime(time.time())))
f.write("\n")
f.write("\n" + "#"*50 + "Test start time: " + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + "#"*50 + "\n")
runner.run(suite)
f.write("\n" + "="*50 + "Test end time: " + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + "="*50 + "\n")
f.close()
with open(logpath,"a+") as f:
fn = open(lognewestpath,'r')