基于Python在MacOS上安装robotframework-ride


Posted in Python onDecember 28, 2018

Robotframework是一个框架,是一个可以用于关键字测试驱动的框架。而RIDE(robotframework-ride)就是可以使得写robot测试用例更加方便快捷的IDE图形操作工具。

安装

因为是基于python的,所以其可以运行在多个操作系统上。这里主要介绍一下RIDE在MacOS上的使用方式。

OS版本

MacOS版本:10.13.2

wxpython

由于RIDE是基于wxpython的应用,所以首先需要保证wxpython已经得到了安装。安装命令如下:

安装命令:brew install wxpython

安装日志

liumiaocn:~ liumiao$ brew install wxpython
==> Installing dependencies for wxpython: gdbm, readline, sqlite, python@2, jpeg, libpng, libtiff, wxmac
==> Installing wxpython dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.15.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gdbm-1.15.high_sierra.bottle.tar.gz
? /usr/local/Cellar/gdbm/1.15: 19 files, 569.8KB
==> Installing wxpython dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-7.0.3_1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring readline-7.0.3_1.high_sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
For compilers to find this software you may need to set:
  LDFLAGS: -L/usr/local/opt/readline/lib
  CPPFLAGS: -I/usr/local/opt/readline/include
==> Summary
? /usr/local/Cellar/readline/7.0.3_1: 46 files, 1.5MB
==> Installing wxpython dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.24.0.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring sqlite-3.24.0.high_sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.
If you need to have this software first in your PATH run:
 echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
  LDFLAGS: -L/usr/local/opt/sqlite/lib
  CPPFLAGS: -I/usr/local/opt/sqlite/include
For pkg-config to find this software you may need to set:
  PKG_CONFIG_PATH: /usr/local/opt/sqlite/lib/pkgconfig
==> Summary
? /usr/local/Cellar/sqlite/3.24.0: 11 files, 3.5MB
==> Installing wxpython dependency: python@2
==> Downloading https://homebrew.bintray.com/bottles/python@2-2.7.15_1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring python@2-2.7.15_1.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/python@2/2.7.15_1/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-mana
==> /usr/local/Cellar/python@2/2.7.15_1/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-mana
==> /usr/local/Cellar/python@2/2.7.15_1/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-mana
==> Caveats
Pip and setuptools have been installed. To update them
 pip install --upgrade pip setuptools
You can install Python packages with
 pip install <package>
They will install into the site-package directory
 /usr/local/lib/python2.7/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
? /usr/local/Cellar/python@2/2.7.15_1: 4,673 files, 82.8MB
==> Installing wxpython dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-9c.high_sierra.bottle.tar.gz
curl: (6) Could not resolve host: akamai.bintray.com
Error: Failed to download resource "jpeg"
Download failed: https://homebrew.bintray.com/bottles/jpeg-9c.high_sierra.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading http://www.ijg.org/files/jpegsrc.v9c.tar.gz
######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/jpeg/9c
==> make install
? /usr/local/Cellar/jpeg/9c: 21 files, 749.8KB, built in 33 seconds
==> Installing wxpython dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.34.high_sierra.bottle.tar.gz
curl: (6) Could not resolve host: akamai.bintray.com
Error: Failed to download resource "libpng"
Download failed: https://homebrew.bintray.com/bottles/libpng-1.6.34.high_sierra.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://downloads.sourceforge.net/libpng/libpng-1.6.34.tar.xz
==> Downloading from https://downloads.sourceforge.net/project/libpng/libpng16/1.6.34/libpng-1.6.34.tar.xz
######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/libpng/1.6.34
==> make
==> make test
==> make install
? /usr/local/Cellar/libpng/1.6.34: 26 files, 1.2MB, built in 1 minute 38 seconds
==> Installing wxpython dependency: libtiff
==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.9_3.high_sierra.bottle.tar.gz
curl: (6) Could not resolve host: akamai.bintray.com
Error: Failed to download resource "libtiff"
Download failed: https://homebrew.bintray.com/bottles/libtiff-4.0.9_3.high_sierra.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz
curl: (28) Resolving timed out after 5551 milliseconds
Trying a mirror...
==> Downloading https://fossies.org/linux/misc/tiff-4.0.9.tar.gz
#########################                         34.8%
######################################################################## 100.0%
==> Downloading https://mirrors.ocf.berkeley.edu/debian/pool/main/t/tiff/tiff_4.0.9-5.debian.tar.xz
######################################################################## 100.0%
==> Patching
==> Applying patches/CVE-2017-9935.patch
patching file libtiff/tif_dir.c
patching file tools/tiff2pdf.c
==> Applying patches/CVE-2017-18013.patch
patching file libtiff/tif_print.c
==> Applying patches/CVE-2018-5784.patch
patching file contrib/addtiffo/tif_overview.c
patching file tools/tiff2pdf.c
patching file tools/tiffcrop.c
==> Applying patches/CVE-2017-11613_part1.patch
patching file libtiff/tif_dirread.c
==> Applying patches/CVE-2017-11613_part2.patch
patching file libtiff/tif_dirread.c
==> Applying patches/CVE-2018-7456.patch
patching file libtiff/tif_dirread.c
patching file libtiff/tif_print.c
==> Applying patches/CVE-2017-17095.patch
patching file tools/pal2rgb.c
==> ./configure --prefix=/usr/local/Cellar/libtiff/4.0.9_3 --without-x --with-jpeg-include-dir=/usr/local/opt/jpeg/include --with-jpeg-
==> make install
? /usr/local/Cellar/libtiff/4.0.9_3: 246 files, 3.5MB, built in 5 minutes 10 seconds
==> Installing wxpython dependency: wxmac
==> Downloading https://homebrew.bintray.com/bottles/wxmac-3.0.4.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring wxmac-3.0.4.high_sierra.bottle.tar.gz
? /usr/local/Cellar/wxmac/3.0.4: 810 files, 23.7MB
==> Installing wxpython
==> Downloading https://homebrew.bintray.com/bottles/wxpython-3.0.2.0_1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring wxpython-3.0.2.0_1.high_sierra.bottle.tar.gz
? /usr/local/Cellar/wxpython/3.0.2.0_1: 1,108 files, 37.9MB
liumiaocn:~ liumiao$

版本确认

liumiaocn:~ liumiao$ brew info wxpython
wxpython: stable 3.0.2.0 (bottled)
Python bindings for wxWidgets
https://www.wxwidgets.org/
/usr/local/Cellar/wxpython/3.0.2.0_1 (1,115 files, 39.9MB) *
 Poured from bottle on 2018-06-19 at 15:52:25
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wxpython.rb
==> Dependencies
Required: python@2 ✔, wxmac ✔
liumiaocn:~ liumiao$

暂定对应1:wxpython安装之后,目前的版本还缺少一个软连接才能正常动作,根据日志可以看到此次安装的wxpython版本为wxpython-3.0.2.0_1, 按照如下操作创建软连接即可

创建链接

liumiaocn:bin liumiao$ pwd
/usr/local/bin
liumiaocn:bin liumiao$ ls wx
ls: wx: No such file or directory
liumiaocn:bin liumiao$ ln -s ../Cellar/wxpython/3.0.2.0_1/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx wx
liumiaocn:bin liumiao$

确认方式

liumiaocn:~ liumiao$ python -c "import wx; print wx.VERSION"
/usr/local/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx/_core.py:16633: UserWarning: wxPython/wxWidgets release number mismatch
 warnings.warn("wxPython/wxWidgets release number mismatch")
(3, 0, 2, 0, '')
liumiaocn:~ liumiao$

虽然仍然提示warning信息,但是已经能够正常继续动作了。

安装robotframework-ride

使用pip安装robotframework-ride, 安装命令如下

安装命令:pip install robotframework-ride

启动确认

通过ride.py启动RIDE,当前版本出现了如下错误信息

liumiaocn:bin liumiao$ ride.py
Wrong wxPython version.
You need to install wxPython 2.8.12.1 with unicode support to run RIDE.
wxPython 2.8.12.1 can be downloaded from http://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/
liumiaocn:bin liumiao$

原因确认:经过定位代码中错误出现的位置,确认到如下文件:

liumiaocn:local liumiao$ find . -name '*.py' |xargs grep 'You need to install wxPython'
./lib/python2.7/site-packages/robotide/__init__.py:You need to install wxPython 2.8.12.1 with unicode support to run RIDE.
liumiaocn:local liumiao$ view ./lib/python2.7/site-packages/robotide/__init__.py
liumiaocn:local liumiao$ grep supported_versions ./lib/python2.7/site-packages/robotide/__init__.py
supported_versions = ["2.8"]
    supported_versions.append("2.9")
  wxversion.select(supported_versions)
liumiaocn:local liumiao$

对应方法1:直接将支持的版本号修改为当前的版本

liumiaocn:~ liumiao$ diff /usr/local/lib/python2.7/site-packages/robotide/__init__.py /usr/local/lib/python2.7/site-packages/robotide/__init__.py.org
37,38c37
< #supported_versions = ["2.8"]
< supported_versions = ["3.0.2.0"]
---
> supported_versions = ["2.8"]
liumiaocn:~ liumiao$

对应方法2:添加supported_versions

liumiaocn:~ liumiao$ diff /usr/local/lib/python2.7/site-packages/robotide/__init__.py /usr/local/lib/python2.7/site-packages/robotide/__init__.py.org
44d43
<     supported_versions.append("3.0.2.0")
liumiaocn:~ liumiao$

实际上在如下行添加了对当前版本的支持

try:
   import wxversion
   from wxversion import VersionError
   if sys.platform == 'darwin':
     supported_versions.append("2.9")
     supported_versions.append("3.0.2.0")
   wxversion.select(supported_versions)
   import wx

安装robotframework

使用pip install robotramework进行robotframework的安装

liumiaocn:~ liumiao$ pip install robotframework
Collecting robotframework
 Downloading https://files.pythonhosted.org/packages/95/b1/4faa12e1950b9fbd00060c112fa6f828c4f3998e9b2f8c570c22db10bc88/robotframework-3.0.4.tar.gz (443kB)
  100% |????????????????????????????????| 450kB 34kB/s 
Building wheels for collected packages: robotframework
 Running setup.py bdist_wheel for robotframework ... done
 Stored in directory: /Users/liumiao/Library/Caches/pip/wheels/8a/01/4a/fd9aef57cca0087d0bd5ceba5db39247ef375fdc4df5ebfb59
Successfully built robotframework
Installing collected packages: robotframework
Successfully installed robotframework-3.0.4
liumiaocn:~ liumiao$

启动RIDE

在命令行输入ride.py并回车,便可启动RIDE

基于Python在MacOS上安装robotframework-ride

安装pygments

Text Edit的tab提示需要安装高亮显示用的包pygments

基于Python在MacOS上安装robotframework-ride

使用pip install pygments进行安装

liumiaocn:~ liumiao$ pip install pygments
Collecting pygments
 Downloading https://files.pythonhosted.org/packages/02/ee/b6e02dc6529e82b75bb06823ff7d005b141037cb1416b10c6f00fc419dca/Pygments-2.2.0-py2.py3-none-any.whl (841kB)
  100% |????????????????????????????????| 849kB 1.9MB/s 
Installing collected packages: pygments
Successfully installed pygments-2.2.0
liumiaocn:~ liumiao$

再次启动ride.py,已经可以正常动作了。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对三水点靠木的支持。如果你想了解更多相关内容请查看下面相关链接

Python 相关文章推荐
让 python 命令行也可以自动补全
Nov 30 Python
在Python3中使用asyncio库进行快速数据抓取的教程
Apr 02 Python
python使用super()出现错误解决办法
Aug 14 Python
python基础_文件操作实现全文或单行替换的方法
Sep 04 Python
Python实现利用最大公约数求三个正整数的最小公倍数示例
Sep 30 Python
Ubuntu安装Jupyter Notebook教程
Oct 18 Python
浅谈pycharm出现卡顿的解决方法
Dec 03 Python
python实现桌面壁纸切换功能
Jan 21 Python
python 内置函数汇总详解
Sep 16 Python
Pycharm 2019 破解激活方法图文详解
Oct 11 Python
使用python实现画AR模型时序图
Nov 20 Python
python实现自动清理文件夹旧文件
May 10 Python
Python3爬虫之urllib携带cookie爬取网页的方法
Dec 28 #Python
Python编程图形库之Pillow使用方法讲解
Dec 28 #Python
对python中大文件的导入与导出方法详解
Dec 28 #Python
Python编程深度学习计算库之numpy
Dec 28 #Python
python将txt文档每行内容循环插入数据库的方法
Dec 28 #Python
pandas 把数据写入txt文件每行固定写入一定数量的值方法
Dec 28 #Python
Python计算库numpy进行方差/标准方差/样本标准方差/协方差的计算
Dec 28 #Python
You might like
一个程序下载的管理程序(二)
2006/10/09 PHP
PHP递归删除目录几个代码实例
2014/04/21 PHP
PHP制作图形验证码代码分享
2014/10/23 PHP
详解PHP的Yii框架中的Controller控制器
2016/03/29 PHP
在JS中如何调用JSP中的变量
2014/01/22 Javascript
js确认删除对话框效果的示例代码
2014/02/20 Javascript
jQuery插件slides实现无缝轮播图特效
2015/04/17 Javascript
Js 获取、判断浏览器版本信息的简单方法
2016/08/08 Javascript
微信小程序开发之视频播放器 Video 弹幕 弹幕颜色自定义实例
2016/12/08 Javascript
Bootstrap整体框架之CSS12栅格系统
2016/12/15 Javascript
node.js入门教程之querystring模块的使用方法
2017/02/27 Javascript
react-router实现跳转传值的方法示例
2017/05/27 Javascript
Angularjs 双向绑定时字符串的转换成数字类型的问题
2017/06/12 Javascript
微信小程序之分享页面如何返回首页的示例
2018/03/28 Javascript
node和vue实现商城用户地址模块
2018/12/05 Javascript
jQuery动态操作表单示例【基于table表格】
2018/12/06 jQuery
Vue 3.0双向绑定原理的实现方法
2019/10/23 Javascript
继承行为在 ES5 与 ES6 中的区别详解
2019/12/24 Javascript
Python Queue模块详细介绍及实例
2016/12/27 Python
Gauss-Seidel迭代算法的Python实现详解
2019/06/29 Python
python+opencv像素的加减和加权操作的实现
2019/07/14 Python
Python大数据之网络爬虫的post请求、get请求区别实例分析
2019/11/16 Python
完美解决ARIMA模型中plot_acf画不出图的问题
2020/06/04 Python
python判断字符串以什么结尾的实例方法
2020/09/18 Python
前端面试必备之html5的新特性
2017/09/05 HTML / CSS
html5的自定义data-*属性与jquery的data()方法的使用
2014/07/02 HTML / CSS
Canvas环形饼图与手势控制的实现代码
2019/11/08 HTML / CSS
全球性的奢侈品梦工厂:Forzieri(福喜利)
2019/02/20 全球购物
《桂林山水》教学反思
2014/02/08 职场文书
班班通校本培训方案
2014/03/12 职场文书
领导干部群众路线教育实践活动剖析材料
2014/10/10 职场文书
中学生的1000字检讨书
2014/10/11 职场文书
幼儿园园长六一致辞
2015/07/31 职场文书
医院保洁员管理制度
2015/08/05 职场文书
学困生转化工作总结
2015/08/13 职场文书
python热力图实现的完整实例
2022/06/25 Python