logging with colors

This commit is contained in:
httprunner
2018-02-21 12:32:14 +08:00
parent 0e0805d230
commit e49214ec52
10 changed files with 153 additions and 84 deletions

View File

@@ -3,9 +3,11 @@ import multiprocessing
import os
import sys
from httprunner.testcase import load_test_file
from locust.main import main
from .logger import color_print
from .testcase import load_test_file
def parse_locustfile(file_path):
""" parse testcase file and return locustfile path.
@@ -13,7 +15,7 @@ def parse_locustfile(file_path):
if file_path is a YAML/JSON file, convert it to locustfile
"""
if not os.path.isfile(file_path):
print("file path invalid, exit.")
color_print("file path invalid, exit.", "RED")
sys.exit(1)
file_suffix = os.path.splitext(file_path)[1]
@@ -23,7 +25,7 @@ def parse_locustfile(file_path):
locustfile_path = gen_locustfile(file_path)
else:
# '' or other suffix
print("file type should be YAML/JSON/Python, exit.")
color_print("file type should be YAML/JSON/Python, exit.", "RED")
sys.exit(1)
return locustfile_path