本文整理汇总了Python中robot.libraries.BuiltIn.BuiltIn.strip方法的典型用法代码示例。如果您正苦于以下问题:Python BuiltIn.strip方法的具体用法?Python BuiltIn.strip怎么用?Python BuiltIn.strip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类robot.libraries.BuiltIn.BuiltIn
的用法示例。
在下文中一共展示了BuiltIn.strip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_log_directory
# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import strip [as 别名]
def test_log_directory():
"""This function will create case log directory for saving TA log when you call it firstly.
If you want to save or use TA log, you must call this keyword on your TA case.
"""
global TEST_CASE_NAME
global TEST_LOG_PATH
try:
test_case_name = BuiltIn().get_variables()['${TEST_NAME}']
except:
try:
test_case_name = BuiltIn().get_variables()['${SUITE_NAME}']
except:
test_case_name = "mt_case_name"
test_case_name = test_case_name.strip().replace(" ", "_")
if TEST_CASE_NAME != test_case_name:
try:
output_dir = BuiltIn().get_variables()['${OUTPUT_DIR}']
except:
output_dir = "mt_output_dir"
test_suite_path = os.path.join(output_dir, "log")
TEST_CASE_NAME = test_case_name
test_name_with_timestamp = test_case_name + "_" + time.strftime("%Y%m%d%H%M%S", time.localtime()) + "/"
test_log_directory = os.path.join(test_suite_path, test_name_with_timestamp)
TEST_LOG_PATH = test_log_directory
if not os.path.exists(TEST_LOG_PATH):
os.makedirs(TEST_LOG_PATH)
return TEST_LOG_PATH