我正试图在我的Mac终端中使用pytest
。我没有pytest.ini
设置,现在也不想设置
当我单独运行命令pytest
时,它会为我的虚拟环境(名为venv
,位于项目的根目录中)中的多个站点包打印警告(DeprecationWarning
)
venv/lib/python3.6/site-packages/eventlet/patcher.py:1
/path/to/venv/lib/python3.6/site-packages/eventlet/patcher.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
我想在运行pytest
时忽略venv/
目录,因此我的警告仅与我的项目相关
我如何才能不在虚拟环境中运行pytest
?
我尝试过的
我尝试了多个版本的--ignore
标志:
pytest --ignore=venv
pytest --ignore=./venv/
pytest --ignore="venv/*"
pytest --ignore="./venv/*"
(source)
并使用-k
pytest -k 'not venv'
(source)
我读过的内容
--disable-pytest-warnings
:我仍然希望显示其他警告
--pythonwarnings ignore::DeprecationWarning
似乎太通用了(如果我的一个项目文件使用了不推荐使用的模块怎么办)
--pythonwarnings ignore::DeprecationWarning:some_package.*:
太手动了(我的很多网站包都会生成警告)
版本控制
macOS Mojave v10.14.3
Python 3.6.5
pytest==5.3.5
目前没有回答
相关问题 更多 >
编程相关推荐