pytest1-Installation and Getting Started
pytest是python的一种单元测试框架(非自带,需要安装),与python自带的unitest测试框架相比,使用起来更加简洁、效率更高。总之,一句话,pytest优于unitest。
1.安装pytest (其中-U 指升级原来已经安装的包)查看安装版本

查看安装版本 pip show pytest 或者 pytest --version


2.使用pytest的一个demo
# test_open_url.py
from selenium import webdriver def test_open_url():
try:
driver = webdriver.Chrome()
driver.get("http://www.baidu.com")
title = driver.title
print(driver.title) assert title == '百度一下,你就知道' # pytest允许使用python的标准assert语句进行断言处理 except AssertionError:
raise AssertionError("断言失败!")
driver.quit() def testbaidu():
driver = webdriver.Chrome()
driver.get("http://www.baidu.com")
title = driver.title
print(title)
方式一:进入命令行模式(Terminal):输入pytest 后回车
方式二:(方法二需要设置pycharm执行器为pytest(该执行器支持unitest的代码)pycharm中如何为项目设置默认执行器?)

pytest1-Installation and Getting Started的更多相关文章
- mysql-5.6.34 Installation from Source code
Took me a while to suffer from the first successful souce code installation of mysql-5.6.34. Just pu ...
- Create an offline installation of Visual Studio 2017 RC
Create an offline installation of Visual Studio 2017 RC 2016年12月7日 ...
- An error occurred during the installation of assembly 'Microsoft.VC90.CRT……的问题
有一段时间没有用到AnkhSvn了,今天工作需要安装了一下.结果安装到一半就无法继续了,提示An error occurred during the installation of assembly ...
- "Installation failed !" in GUI but not in CLI (/usr/bin/winusb: line 78: 18265 Terminated )
"Installation failed !" in GUI but not in CLI (/usr/bin/winusb: line 78: 18265 Terminated ...
- pymol installation
# download (1) python wget https://www.python.org/ftp/python/2.7.9/python-2.7.9.amd64.msi (2) pymol ...
- 安卓真机调试 出现Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE....
[2016-08-20 14:38:39 - hybrid-android] Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE[2016-0 ...
- The Installation and Compilation of OpenCASCADE
OpenCASCADE的编译 The Installation and Compilation of OpenCASCADE eryar@163.com 一. 安装OpenCASCADE 可以从Ope ...
- kali 2.0 U盘安装错误Your installation cd-rom couldn't be mounted
1.kali 2.0前天(2015.08.11)发布了.果断下载下来换掉本机的1.0版本. 2.用U盘安装的过程中,出现cd-rom无法挂载.提示错误Your installation CD-ROM ...
- linuxx virutal machine installation
1. vmplayer download: https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player ...
- linux apt-get install 错误: Package has no installation candidate
sudo apt-get install vim 在安装vim时报如下错误: Error accoured: This may mean that the package is missing, ha ...
随机推荐
- 55 (OC)* 图片圆角处理
iOS图片设置圆角性能优化 问题 圆角虽好,但如果使用不当,它就是你的帧数杀手,特别当它出现在滚动列表的时候.下面来看圆角如何毁掉你的流畅度的. 实测 layer.cornerRadius 我创建 ...
- 提交任务到spark(以wordcount为例)
1.首先需要搭建好hadoop+spark环境,并保证服务正常.本文以wordcount为例. 2.创建源文件,即输入源.hello.txt文件,内容如下: tom jerry henry jim s ...
- nginx重启失败,无法关闭nginx占用端口
nginx配置修改后,需要重启nginx,出现上图中的异常. 找不见无法正常nginx的原因,所以只能强制关闭所有端口,再重启nginx 运行命令:fuser -k 80/tcp
- css超出多行隐藏
单行隐藏: overflow: hidden;/*超出部分隐藏*/ text-overflow:ellipsis;/* 超出部分显示省略号 */ white-space: nowrap;/*规定段 ...
- Node 与JS的区别
1.nodejs是运行于服务器端的:2.global:代表node当中的一个全局对象,类似于浏览器当中的window,定义全局对象:global.a:3.作用域:nodejs中一个文件就是一个作用域: ...
- Codeforces New Year and Buggy Bot 题解
主要思路:全排列,然后按输入的字符串走并且判断是否撞墙 注:这样不会TLE,全排列最多24种 Code(C++): #include<bits/stdc++.h> using namesp ...
- Python连载40-协程定义及状态、send语句、yield用法
一.协程 1.历史进程: (1)3.4引入协程,用yield来实现 (2)3.5引入协程语法 (3)实现协程比较好的包有asyncio,tornado,gevent 2.定义:协程是为非抢占式多任务产 ...
- Linux 伪终端(pty)
通过<Linux 终端(TTY)>一文我们了解到:我们常说的终端分为终端 tty1-6 和伪终端.使用 tty1-6 的情况一般为 Linux 系统直接连了键盘和显示器,或者是使用了 vS ...
- Dubbo学习系列之十三(Mycat数据库代理)
软件界有只猫,不用我说,各位看官肯定知道是哪只,那就是大名鼎鼎的Tomcat,现在又来了一只猫,据说是位东方萌妹子,暂且认作Tom猫的表妹,本来叫OpencloudDB,后又改名为Mycat,或许Ca ...
- 基于Docker搭建大数据集群(一)Docker环境部署
本篇文章是基于Docker搭建大数据集群系列的开篇之作 主要内容 docker搭建 docker部署CentOS 容器免密钥通信 容器保存成镜像 docker镜像发布 环境 Linux 7.6 一.D ...