Commit ce3ed771 ce3ed77124892d38b8ec66a69afb03b086b88f61 by chenjing

兼容异常场景

1 parent 3f7d769d
...@@ -18,7 +18,7 @@ def should_run_in_env(env_scope, current_env): ...@@ -18,7 +18,7 @@ def should_run_in_env(env_scope, current_env):
18 判断用例是否应在当前环境执行 18 判断用例是否应在当前环境执行
19 19
20 env_scope 格式: 20 env_scope 格式:
21 - 空'all' → 所有环境执行 21 - 空、None、'None'、'all' → 所有环境执行
22 - 'test' → 仅测试环境 22 - 'test' → 仅测试环境
23 - 'uat' → 仅UAT环境 23 - 'uat' → 仅UAT环境
24 - 'prod' → 仅生产环境 24 - 'prod' → 仅生产环境
...@@ -27,7 +27,8 @@ def should_run_in_env(env_scope, current_env): ...@@ -27,7 +27,8 @@ def should_run_in_env(env_scope, current_env):
27 """ 27 """
28 if not env_scope or env_scope.strip() == '': 28 if not env_scope or env_scope.strip() == '':
29 return True 29 return True
30 if env_scope.strip().lower() == 'all': 30 # 处理字符串"None"或"none"的情况
31 if str(env_scope).strip().lower() in ['none', 'all']:
31 return True 32 return True
32 allowed_envs = [e.strip() for e in env_scope.split(',')] 33 allowed_envs = [e.strip() for e in env_scope.split(',')]
33 return current_env in allowed_envs 34 return current_env in allowed_envs
......