当我在 pipelinev shell 中运行 pytest 时,我得到以下信息:
\n pipenv shell\nLoading .env environment variables\xe2\x80\xa6\nLaunching subshell in virtual environment\xe2\x80\xa6\n\nThe default interactive shell is now zsh.\nTo update your account to use zsh, please run `chsh -s /bin/zsh`.\nFor more details, please visit https://support.apple.com/kb/HT208050.\nbash-3.2$ . /Users/.../.local/share/virtualenvs/kittycapital-UOiJxZhy/bin/activate\n(kittycapital) bash-3.2$ python -m pytest\n============================================================================================================================= test session starts ==============================================================================================================================\nplatform darwin -- Python 3.7.7, pytest-5.4.3, py-1.9.0, pluggy-0.13.1\nrootdir: /Users/.../kittycapital\nplugins: mock-3.1.1\ncollected 4 items\n\ntests/test_account.py . [ 25%]\ntests/test_pair.py .. [ 75%]\ntests/helpers/test_number_helpers.py . [100%]\n\n=============================================================================================================================== warnings summary ===============================================================================================================================\n/Users/.../.local/share/virtualenvs/kittycapital-UOiJxZhy/lib/python3.7/site-packages/urllib3/util/selectors.py:14\n /Users/.../.local/share/virtualenvs/kittycapital-UOiJxZhy/lib/python3.7/site-packages/urllib3/util/selectors.py:14: DeprecationWarning: Using or importing the ABCs from \'collections\' instead of from \'collections.abc\' is deprecated since Python 3.3,and in 3.9 it will stop working\n from collections import namedtuple, Mapping\n\n/Users/.../.local/share/virtualenvs/kittycapital-UOiJxZhy/lib/python3.7/site-packages/urllib3/_collections.py:2\n /Users/.../.local/share/virtualenvs/kittycapital-UOiJxZhy/lib/python3.7/site-packages/urllib3/_collections.py:2: DeprecationWarning: Using or importing the ABCs from \'collections\' instead of from \'collections.abc\' is deprecated since Python 3.3,and in 3.9 it will stop working\n from collections import Mapping, MutableMapping\n\n-- Docs: https://docs.pytest.org/en/latest/warnings.html\nRun Code Online (Sandbox Code Playgroud)\n我如何摆脱这些警告?
\n小智 8
将依赖项升级到不会触发警告的版本,或者将其放入pytest.ini以隐藏该警告:
[pytest]
filterwarnings = ignore:.*Using or importing the ABCs.*is deprecated:DeprecationWarning
Run Code Online (Sandbox Code Playgroud)
请参阅https://docs.pytest.org/en/stable/warnings.html#deprecationwarning-and-pendingdeprecationwarning
或者使用该--disable-warnings标志隐藏所有警告:
python -m pytest --disable-warnings
Run Code Online (Sandbox Code Playgroud)
请参阅https://docs.pytest.org/en/stable/warnings.html#disabling-warnings-summary
| 归档时间: |
|
| 查看次数: |
2890 次 |
| 最近记录: |