Robotframework - 在变量文件中使用环境变量

时间:2022-12-22 23:49:44

I would like to construct a variable for RobotFramework within the variable file but using the Linux environmental variable. Could you advise on the syntax please ?? My current attempts with this:

我想在变量文件中为RobotFramework构造一个变量,但是使用Linux环境变量。你能告诉我的语法吗?我目前的尝试:

vif_vlan       = "110"

path_scripts   = '%{MY_DIR}/my_path/scripts'

remote_path    = "/home/mcast/mgen"

end up in not expanding the env variable %{MY_DIR} ...

最终没有扩展env变量%{MY_DIR} ...

Tx

1 个解决方案

#1


Environment variables are in the environ dictionary of the os module:

环境变量位于os模块的environ字典中:

import os
path_scripts = os.path.join(os.environ['MY_DIR']', 'my_path', 'scripts')

#1


Environment variables are in the environ dictionary of the os module:

环境变量位于os模块的environ字典中:

import os
path_scripts = os.path.join(os.environ['MY_DIR']', 'my_path', 'scripts')