python-3.x - Pytest Html 报告不可用
问题描述
我正在尝试为我的 pytest 生成 html 报告。我看到非常奇怪的行为。首先我在 raspbian 上运行,使用 python 3.7。
我正在运行两个命令
pytest --html=report.html DeviceTests/DisioOnUsb.py --device_id 9101 --firmware_version 0.1.1
和
sudo pytest --html=report.html DeviceTests/DisioOnUsb.py --device_id 9101 --firmware_version 0.1.1
现在我需要使用 sudo 因为我没有提升这个用户的权限。如果我运行第一个命令 pytest 运行良好,创建 html 但失败,因为后面的一些操作需要提升的用户权限。第二个命令失败并告诉我
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --html=report.html
inifile: None
rootdir: /home/pi/Documents/Disio Production Test
当我列出我的插件时,一切似乎都井井有条。sudo 在做什么?为什么我不能使用 sudo 创建此报告?
pi@raspberrypi:~/Documents/Disio Production Test $ pip3 freeze | grep pytest
pytest==6.2.5
pytest-html==3.1.1
pytest-metadata==1.11.0
解决方案
为了解决我的问题,我执行了操作
sudo pip3 uninstall pytest-html
其次是
sudo pip3 install pytest-html
推荐阅读
- javascript - 从jquery在div内迭代调用函数
- excel - 无法让 Delphi ADOQuery 更新或插入 Excel 工作表
- c# - 在两个方法c#之间来回传递参数
- python - 使用python 3在virtualenv中启动django项目时出现Django syntaxError
- angular - 指令Angular 2上的停止按钮单击事件
- python - ModuleNotFoundError:夜间没有名为“google”的模块,代码没有变化
- asp.net - 如何将 asp .Net 网站文件夹转换为 C# 中的 Web 应用程序?
- sql-server - SQL Server:始终加密的存储过程 - 列/变量的加密方案不匹配
- nginx - nginx的问题。开始时
- flutter - Flutter 在极端情况下对齐两项 - 一项在左侧,一项在右侧