mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
print python 2 retire message as warning
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
__title__ = 'HttpRunner'
|
||||
__description__ = 'One-stop solution for HTTP(S) testing.'
|
||||
__url__ = 'https://github.com/HttpRunner/HttpRunner'
|
||||
__version__ = '1.3.3'
|
||||
__version__ = '1.3.4'
|
||||
__author__ = 'debugtalk'
|
||||
__author_email__ = 'mail@debugtalk.com'
|
||||
__license__ = 'MIT'
|
||||
|
||||
@@ -6,10 +6,11 @@ import unittest
|
||||
|
||||
from httprunner import logger
|
||||
from httprunner.__about__ import __version__
|
||||
from httprunner.compat import is_py2
|
||||
from httprunner.task import HttpRunner
|
||||
from httprunner.utils import (create_scaffold, load_dot_env_file,
|
||||
prettify_json_file, print_output,
|
||||
validate_json_file)
|
||||
from httprunner.utils import (create_scaffold, get_python2_retire_msg,
|
||||
load_dot_env_file, prettify_json_file,
|
||||
print_output, validate_json_file)
|
||||
|
||||
|
||||
def main_hrun():
|
||||
@@ -51,6 +52,9 @@ def main_hrun():
|
||||
args = parser.parse_args()
|
||||
logger.setup_logger(args.log_level)
|
||||
|
||||
if is_py2:
|
||||
logger.log_warning(get_python2_retire_msg())
|
||||
|
||||
if args.version:
|
||||
logger.color_print("{}".format(__version__), "GREEN")
|
||||
exit(0)
|
||||
|
||||
@@ -10,6 +10,7 @@ import random
|
||||
import re
|
||||
import string
|
||||
import types
|
||||
from datetime import datetime
|
||||
|
||||
from httprunner import exception, logger
|
||||
from httprunner.compat import OrderedDict, is_py2, is_py3
|
||||
@@ -457,3 +458,15 @@ def prettify_json_file(file_list):
|
||||
out.write('\n')
|
||||
|
||||
print("success: {}".format(outfile))
|
||||
|
||||
def get_python2_retire_msg():
|
||||
retire_day = datetime(2020, 1, 1)
|
||||
today = datetime.now()
|
||||
left_days = (retire_day - today).days
|
||||
|
||||
if left_days > 0:
|
||||
retire_msg = "Python 2 will retire in {} days, why not move to Python 3?".format(left_days)
|
||||
else:
|
||||
retire_msg = "Python 2 has been retired, you should move to Python 3."
|
||||
|
||||
return retire_msg
|
||||
|
||||
Reference in New Issue
Block a user