删除无用model模型,优化命令行输入对发送消息支持大小写不敏感
This commit is contained in:
parent
abc8fccaad
commit
f1a4965885
|
@ -11,13 +11,6 @@ from typing import Text, List, Union
|
|||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Environment(Enum):
|
||||
DEV = 'dev'
|
||||
TEST = 'test'
|
||||
PROD = 'prod'
|
||||
DIANJUN = 'dianjun'
|
||||
|
||||
|
||||
@dataclass
|
||||
class TestMetrics:
|
||||
""" 用例结果数据 """
|
||||
|
@ -114,5 +107,6 @@ class MIMEFileType(Enum):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(Environment.DEV.name)
|
||||
print(Environment.DEV.value)
|
||||
print(Method['GET'].value)
|
||||
print(Method.GET.name)
|
||||
print(Method.GET.value)
|
||||
|
|
|
@ -24,11 +24,11 @@ reruns_delay = 5
|
|||
# 当用例达到最大失败数,整个测试停止执行
|
||||
max_fail = 100
|
||||
|
||||
# 设置是否需要发送邮件:Ture发送,False不发送,如果命令行中有 send_email 参数并且有效,使用命令行的值,否则使用默认值
|
||||
IS_SEND_EMAIL = args.send_email == 'True' if args.send_email else False
|
||||
# 设置是否需要发送邮件:Ture发送,False不发送,如果命令行中有 send_email 参数并且有效,使用命令行的值,否则使用else后的默认值
|
||||
IS_SEND_EMAIL = args.send_email == 'true' if args.send_email else False
|
||||
|
||||
# 设置是否需要发送企业微信消息:Ture发送,False不发送,如果命令行中有 send_wechat 参数并且有效,使用命令行的值,否则使用默认值
|
||||
IS_SEND_WECHAT = args.send_wechat == 'True' if args.send_wechat else False
|
||||
# 设置是否需要发送企业微信消息:Ture发送,False不发送,如果命令行中有 send_wechat 参数并且有效,使用命令行的值,否则使用else后的默认值
|
||||
IS_SEND_WECHAT = args.send_wechat == 'true' if args.send_wechat else False
|
||||
|
||||
# 设置是否开启debug日志
|
||||
LOG_DEBUG = False
|
||||
|
|
|
@ -15,9 +15,9 @@ def command_parser():
|
|||
parser = argparse.ArgumentParser()
|
||||
|
||||
# 添加命令行参数选项
|
||||
parser.add_argument('-w', '--send-wechat', choices=['False', 'True'], type=str, default=None,
|
||||
parser.add_argument('-w', '--send-wechat', choices=['false', 'true'], type=lambda s: s.lower(), default=None,
|
||||
help='指定是否需要发送企业微信群消息')
|
||||
parser.add_argument('-e', '--send-email', choices=['False', 'True'], type=str, default=None,
|
||||
parser.add_argument('-e', '--send-email', choices=['false', 'true'], type=lambda s: s.lower(), default=None,
|
||||
help='指定是否需要发送邮件')
|
||||
parser.add_argument('-env', '--env', choices=['DEV', 'TEST', 'PROD'], type=lambda s: s.upper(), default=None,
|
||||
help='指定运行环境,并支持大小输入')
|
||||
|
@ -31,8 +31,8 @@ def command_parser():
|
|||
if __name__ == '__main__':
|
||||
args = command_parser()
|
||||
# 获取命令行参数的值并赋值给对应的变量
|
||||
IS_SEND_WECHAT = eval(args.send_wechat) if args.send_wechat else None
|
||||
IS_SEND_EMAIL = eval(args.send_email) if args.send_email else None
|
||||
IS_SEND_WECHAT = args.send_wechat == 'true' if args.send_wechat else None
|
||||
IS_SEND_EMAIL = args.send_email == 'true' if args.send_email else True
|
||||
ENV = args.env
|
||||
|
||||
# 打印变量的值
|
||||
|
|
Loading…
Reference in New Issue