Appium pytest 执行测试用例后如何生成测试报告

wagnxinghao · 2017年05月27日 · 最后由 yivanus 回复于 2018年03月08日 · 2034 次阅读

我安装了 pytest 和pytest_html 后运行命令:
python test_x.py --html='/Users/hua/Desktop/img/xx.html'
警告信息:
=========warnings summary ===========================================================================
None
passing a string to pytest.main() is deprecated, pass a list of arguments instead.
Module already imported so can not be re-written: flaky
Module already imported so can not be re-written: pytest_html

-- Docs: http://doc.pytest.org/en/latest/warnings.html
但是看不懂是哪里出错了,我看网上运行命令都是>>pytest test_x.py --html='/Users/hua/Desktop/img/xx.html'
但是我这条命令运行不了,难道是这个原因?

共收到 5 条回复 时间 点赞

估计 py.test 没装正确吧,再说运行是 py.test 运行的

试试 python -m pytest test_x.py

谢谢,端午节一来就解决了这个问题,但不知这串代码为什么就可以,我在其他地方找的那串命令就会报错?

徐晓东 回复

使用 python -m pytest test_x.py 可执行成功并生成测试报告,也不知是什么原因

5楼 已删除

pytest test_x.py --html='/Users/hua/Desktop/img/xx.html' 这样运行的。
警告信息是说 模块已经 import 过了。 你的 py 文件里面应该有 import flaky, import pytest_html 这 2 个东西

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册