print python 2 retire message as warning

This commit is contained in:
debugtalk
2018-03-25 23:07:07 +08:00
parent 261169b70e
commit 01dda7b92d
3 changed files with 21 additions and 4 deletions

View File

@@ -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