channy14

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1、新建lib目录

2、MyLibrary目录下创建以下文件

  

 

  1)__init__.py

#__init__.py
#!/usr/bin/python
# -*- coding: UTF-8 -*-

from mylib1 import mylib1
from mylib2 import mylib2
version = '1.0'
class lib(mylib1,mylib2):
    ROBOT_LIBRARY_SCOPE = 'GLOBAL'

  注意:

  version = '1.0'   //版本定义

  ROBOT_LIBRARY_SCOPE = 'GLOBAL'     //这一句代表库是全局的  

 

  2)mylib1.py

# -*- coding: utf-8 -*-
# coding: unicoed_escape
import os

class mylib1:
    def file_check_isexist1(self, filepath):
        """校验文件应存在
        :param filepath:文件路径
        :return: None
        """
        if not os.path.exists(filepath):
            raise AssertionError("Error! '%s' is not exist!" % filepath)

if __name__ == '__main__':
    obj = mylib1()

 

  3)mylib2.py

# -*- coding: utf-8 -*-
# coding: unicoed_escape
import os

class mylib2:
    def file_check_isexist2(self, filepath):
        """校验文件应存在
        :param filepath:文件路径
        :return: None
        """
        if not os.path.exists(filepath):
            raise AssertionError("Error! '%s' is not exist!" % filepath)

if __name__ == '__main__':
    obj = mylib2()

 

3、RF导入库的时候路径选择lib所在位置,导入成功(黑色)

4、RF中输入F5选择lib库查看生效的方法:

 

posted on 2019-07-02 15:46  channy14  阅读(1110)  评论(0编辑  收藏  举报