【发布时间】:2019-11-04 16:10:57
【问题描述】:
我有一个包含我的函数的 myfun.py 文件。
我有一个带有pytest 测试的test_myfun.py 文件。
当运行pytest test_myfun.py 时,测试本身运行没有错误,但 pytest 会给出警告。
有什么建议可以解决这些警告吗?
=============================== warnings summary ===============================
/home/rene/anaconda3/lib/python3.7/site-packages/html5lib/_trie/_base.py:3
/home/rene/anaconda3/lib/python3.7/site-packages/html5lib/_trie/_base.py:3: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Mapping
/home/rene/anaconda3/lib/python3.7/site-packages/scrapy/item.py:8
/home/rene/anaconda3/lib/python3.7/site-packages/scrapy/item.py:8: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import MutableMapping
-- Docs: https://docs.pytest.org/en/latest/warnings.html
==================== 11 passed, 2 warnings in 7.47 seconds =====================
版本信息:
- Python 3.7.3
- pytest 4.6.2
# packages in environment at /home/rene/anaconda3:
#
# Name Version Build Channel
pytest 4.6.2 py37_0
pytest-arraydiff 0.3 py37h39e3cac_0
pytest-astropy 0.5.0 py37_0
pytest-doctestplus 0.3.0 py37_0
pytest-openfiles 0.3.2 py37_0
pytest-remotedata 0.3.1 py37_0
pytest-runner 4.4 py_0
【问题讨论】:
-
那些包需要更新,仅此而已。它们仍然兼容,但在 3.8 中将不再兼容,这就是消息所说的
-
谢谢,但我从 Anaconda 安装了最新的软件包,但仍然收到这些警告。
-
是的,正是因为作者还没有修复警告。当我说“更新”时,我的意思是“由修复代码的人更新”,而不是使用“pip”升级的人,因为升级还不存在。