1:在python目录下lib\site-packages 建立库文件文件夹 MyLibrary
获取路径命令mac:python -c "from distutils.sysconfig import get_python_lib; print get_python_lib() "
windows: python -c "import pip; print(pip.__path__[0])"
或者建立一个文件zbj.pth里面放你的库的路径:/Volumes/win/gitlabNew/vgp-test/automation/platform
2:在MyLibrary 内建立 MyTestLibrary.py 文件
这个文件里面写自己的关键字(既方法)
注意各种缩进,python中缩进错误也会报错
3.在Library 内建立 __init__.py
文件
__version__ = '0.1'
from CopyBuildIn import BulidInClass
class Common(BulidInClass):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
def __init__(self):
BulidInClass.__init__(self)
如果有多个类MyTestLibrary
、MyTest2
需要引用,如下
from MyTestLibrary import MyTestLibrary
from MyTest2 import MyTest2
version = '1.0'
class MyLibrary(MyTestLibrary,MyTest2):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
4.RIDE中导入库,用文件夹名字导入就行