Python 抑制弃用警告并不总是有效

Python 抑制弃用警告并不总是有效,python,exception,python-3.8,Python,Exception,Python 3.8,在许多情况下,例如在运行pytest或在Flask服务器中,我都会得到相同的DeprecationWarning: + pytest -s -W ignore::DeprecationWarning ========================================== test session starts =========================================== platform linux -- Python 3.8.1, pytest-5.4.

在许多情况下,例如在运行
pytest
或在Flask服务器中,我都会得到相同的
DeprecationWarning

+ pytest -s -W ignore::DeprecationWarning
========================================== test session starts ===========================================
platform linux -- Python 3.8.1, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /home/user/projects/myproject
plugins: dash-1.9.1
collected 39 items                                                                                       

tests/test_cache.py ......
[...]

============================================ warnings summary ============================================
/home/user/projects/myproject/venv/lib/python3.8/site-packages/past/builtins/misc.py:45
  /home/user/projects/myproject/venv/lib/python3.8/site-packages/past/builtins/misc.py:45: DeprecationWarning:

  the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

-- Docs: https://docs.pytest.org/en/latest/warnings.html
===================================== 39 passed, 1 warning in 16.64s =====================================

原因是什么?我怎样才能抑制这件事