Fra*_*Tap 5 python warnings pytest pycharm
使用 pytest (6.2.4) 和 Python 3.9 在 PyCharm 2022.3.2(专业版)中运行测试时,我在 PyCharm 控制台窗口中得到以下结果:
D:\cenv\python.exe "D:/Program Files (x86)/JetBrains/PyCharm 2022.3.2/plugins/python/helpers/pycharm/_jb_pytest_runner.py" --path D:\tests\test_k.py 测试开始下午 6:49 ... 在 D:\tests 中使用参数 D:\tests\test_k.py --no-header --no-summary -q 启动 pytest
===============================测试会话开始================== =========== 收集...收集了 5 件物品
test_k.py::test_init test_k.py::test_1 test_k.py::test_2 test_k.py::test_3 test_k.py::test_4
======================= 5 次通过,4.50 秒内 278 条警告 =================== ====
进程已完成,退出代码为 0 已通过 [ 20%]已通过 [ 40%]已通过 [ 60%]已通过 [ 80%]已通过 [100%]
所以实际的警告不会显示。仅显示警告数量 (278)。
我试过:
选择:Pytest:不要在高级设置中添加“--no-header --no-summary -q”
在运行/调试配置窗口中将附加参数设置为 -Wall
在运行/调试配置窗口中将解释器选项设置为 -Wall
以及所有的排列,都无济于事。在 PyCharm 控制台窗口中使用 PyCharm 中的 pytest 运行测试时,有没有办法显示所有运行时警告?
编辑:
@Override12
当我在高级设置中选择不添加“--no-header --no-summary -q”时,我得到以下输出:
D:\Projects\S\SHARK\development_SCE\cev\python.exe "D:/Program Files (x86)/JetBrains/PyCharm 2020.3.4/plugins/python/helpers/pycharm/_jb_pytest_runner.py" --path D: \Projects\S\SHARK\development_SCE\cenv\Lib\site-packages\vistrails-3.5.0rc0-py3.9.egg\vistrails\packages\SHARK\analysis\tests\test_fairing_1_plus_k.py -- --jb-show-摘要测试于上午 10:07 开始...使用参数启动 pytest D:\Projects\S\SHARK\development_SCE\cenv\Lib\site-packages\vistrails-3.5.0rc0-py3.9.egg\vistrails\packages\ D:\Projects\S\SHARK\development_SCE\cenv\Lib\site-packages\vistrails-3.5.0rc0-py3.9.egg\vistrails\packages 中的 SHARK\analysis\tests\test_fairing_1_plus_k.py
===============================测试会话开始================== =========== 平台 win32 -- Python 3.9.7、pytest-6.2.4、py-1.10.0、pluggy-0.13.1 -- D:\Projects\S\SHARK\development_SCE\ cenv\python.exe 缓存目录:.pytest_cache 根目录:D:\Projects\S\SHARK\development_SCE\cenv\Lib\site-packages\vistrails-3.5.0rc0-py3.9.egg\vistrails\packages 插件:pytest_check-1.0 .5 收集...收集 5 件物品
SHARK/analysis/tests/test_fairing_1_plus_k.py::test_init SHARK/analysis/tests/test_fairing_1_plus_k.py::test_without_1_k_fairing SHARK/analysis/tests/test_fairing_1_plus_k.py::test_1_k_fairing_given SHARK/analysis/tests/test_fairing_1_plus_k.py::test_ without_1_k_fairing_only_3_values_under_threshold SHARK/分析/测试/test_fairing_1_plus_k.py::test_1_k_fairing_given_only_3_values_under_threshold
================================ 警告摘要 ================== ============= ......\pyreadline\py3k_compat.py:8 D:\Projects\S\SHARK\development_SCE\cenv\lib\site-packages\pyreadline\py3k_compat。 py:8: DeprecationWarning: 自 Python 3.3 起,不推荐使用或导入来自“collections”而不是“collections.abc”的 ABC,并且在 3.10 中它将停止工作 return isinstance(x, collections.Callable)
......\nose\importer.py:12 D:\Projects\S\SHARK\development_SCE\cenv\lib\site-packages\nose\importer.py:12: DeprecationWarning: imp 模块已被弃用导入库;有关其他用途,请参阅模块的文档 from imp import find_module, load_module, acquire_lock, release_lock
SHARK/analysis/tests/test_fairing_1_plus_k.py: 276 个警告 D:\Projects\S\SHARK\development_SCE\cenv\lib\site-packages\pymarin\objects\key.py:1101: UserWarning: siUnits 已弃用,使用 siUnit 警告.warn('siUnits 已弃用,请使用 siUnit')
-- 文档: https: //docs.pytest.org/en/stable/warnings.html ========================= 5 个已通过,278 个警告5.79s =======================
进程已完成,退出代码为 0 已通过 [ 20%]已通过 [ 40%]已通过 [ 60%]已通过 [ 80%]已通过 [100%]
因此显示 4 个警告。不过我想看到所有 278 条警告。
当我从 PyCharm 外部的命令行运行 pytest 时,我得到相同的结果。所以这似乎是一个pytest问题并且似乎与PyCharm无关。
解决方案是两件事的结合:
| 归档时间: |
|
| 查看次数: |
1170 次 |
| 最近记录: |