Skip to content

Commit

Permalink
组件初始化前设置环境变量
Browse files Browse the repository at this point in the history
  • Loading branch information
yepeiwen01 committed Dec 10, 2024
1 parent 605be79 commit 6e524aa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/tests/component_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def check(self, component_cls) -> CheckInfo:
invalid_details.append("{} 没有添加测试case到 component_tool_eval_cases 中".format(component_cls_name))
else:
component_case = self.component_tool_eval_cases[component_cls_name]()
envs = component_case.envs()
os.environ.update(envs)
init_args = component_case.init_args()

try:
Expand Down Expand Up @@ -106,6 +108,9 @@ def check(self, component_cls) -> CheckInfo:
check_pass_flag = False
invalid_details.append(str(e))

for env in envs:
os.environ.pop(env)

if len(invalid_details) > 0:
check_pass_flag = False
invalid_details = ",".join(invalid_details)
Expand Down

0 comments on commit 6e524aa

Please sign in to comment.