- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我经常从我无法控制的库中得到很多弃用,我不想用它们污染测试执行。
如何在不冒从我自己的代码中禁用弃用的风险的情况下避免这种情况?
例子:
================================================================================ warnings summary ==================================================================================
.tox/py27-ansible25-unit/lib/python3.6/site-packages/toml/decoder.py:47
/Users/ssbarnea/os/molecule/.tox/py27-ansible25-unit/lib/python3.6/site-packages/toml/decoder.py:47: DeprecationWarning: invalid escape sequence \.
TIME_RE = re.compile("([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]{3,6}))?")
.tox/py27-ansible25-unit/lib/python3.6/site-packages/sh.py:424
/Users/ssbarnea/os/molecule/.tox/py27-ansible25-unit/lib/python3.6/site-packages/sh.py:424: DeprecationWarning: invalid escape sequence \d
rc_exc_regex = re.compile("(ErrorReturnCode|SignalException)_((\d+)|SIG[a-zA-Z]+)")
.tox/py27-ansible25-unit/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py:152
/Users/ssbarnea/os/molecule/.tox/py27-ansible25-unit/lib/python3.6/site-packages/botocore/vendored/requests/packages/urllib3/connectionpool.py:152: DeprecationWarning: invalid escape sequence \*
最佳答案
我不会重复关于警告捕获的一般主题的 pytest
文档,以供引用:Warnings Capture .从这里,您可以缩小由更严格的过滤器捕获的警告。 filter format是
{action}:{message}:{category}:{module}:{lineno}
带有可跳过的元素。要粘贴到 pytest.ini
中的示例,从一般到具体:
[pytest]
filterwarnings =
ignore:
DeprecationWarning
[pytest]
filterwarnings =
ignore::DeprecationWarning
无效转义序列
的DeprecationWarning
[pytest]
filterwarnings =
ignore:.*invalid escape sequence.*:DeprecationWarning
toml.decoder
模块中忽略 DeprecationWarning
[pytest]
filterwarnings =
ignore::DeprecationWarning:toml.decoder
toml.decoder
模块中忽略 DeprecationWarning
[pytest]
filterwarnings =
ignore::DeprecationWarning:toml.decoder:47
toml.decoder
模块中忽略 DeprecationWarning
,仅在第 47 行且仅在消息中包含 invalid escape sequence
:[pytest]
filterwarnings =
ignore:.*invalid escape sequence.*:DeprecationWarning:toml.decoder:47
关于python - 如何避免使用 pytest 从内部依赖项中获取 DeprecationWarning?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57925071/
%matplotlib 笔记本 import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklea
我们正在将我们的应用程序从 Django 1.6 更新到 1.7。 我们看到很多这样的消息:RemovedInDjango18Warning 有没有办法过滤它们?它们在导入过程中被释放。 我们尝试了
我已经升级到 Django 1.4,现在当我运行我的开发服务器时,我收到以下警告: /home/flc/venvs/myprj/lib/python2.6/site-packages/django/v
我的一些程序运行没有问题,但我仍然收到以下错误代码。它对程序本身没有影响,但我仍然想解决它。 C:\Program Files\JetBrains\PyCharm Community Edition
我最近升级到 numpy 1.9dev。(为了改进 OpenBlas 支持)。 我有一些代码可以执行 x-y其中 x 和 y 是来自概率分布的样本。如果分布是伯努利分布,则它们是 bool 值。如果分
首先我查看了所有相关问题。给出了非常相似的问题。 所以我遵循了链接中的建议,但没有一个对我有用。 Data Conversion Error while applying a function to
我正在使用 python docs 提供的 grouper 配方的修改形式: from itertools import chain, islice def grouper(iterable, n):
我相信这个问题已经被提出了很多次,但我有一个特定的用例,我无法使用网络上描述的许多方法解决问题。 在我的一个项目中,我正在使用 joblib 库,它显示 DeprecationWarning 因为它在
我经常从我无法控制的库中得到很多弃用,我不想用它们污染测试执行。 如何在不冒从我自己的代码中禁用弃用的风险的情况下避免这种情况? 例子: ===============================
我已经搜索过了,但无法完全找到答案。我想要一个来自 sympy 的具有特定维度的 Matrix 的简单子(monad)类。当我在 python 2.7 中运行此代码时: from sympy impo
已经应用了 require('events') 但仍然不断显示警告,我在这里做错了什么?为什么 process.EventEmitter 即使未使用也会一直显示? Node v6.7.0 它可以工作,
我最近在我的一台机器上更新了 Python 的 Numpy 包,显然我一直依赖 a deprecated feature of numpy现在有一段时间了: >>> np.__version__ '1
我在将模型的预测与训练集的标签进行比较时遇到了问题。我使用的数组具有以下形状: Training set (200000, 28, 28) (200000,) Validation set (1000
使用文档运行 rasa_core 示例 › python3 -m rasa_core.run -d models/dialogue -u models/nlu/default/current 并在对话
尝试更新 MongoDB 文档获取弃用警告为 (node:71307) [DEP0079] DeprecationWarning: Custom inspection function on Obje
当我运行 pytest 时,我收到了来自 3rd 方库的一些弃用警告。我想知道我自己的代码中的任何弃用警告,但不是在与另一个 3rd 方库捆绑在一起的库的供应商副本中。 This answer帮助我中
我是当我尝试运行 nodemon app.js socioboard-api/user 时,出现以下错误 [nodemon] 1.19.3 [nodemon] to restart at any ti
我想使用以下方法获取帖子文档的数量: db.collection('posts').count() 但是,我收到了警告: DeprecationWarning: collection.count is
我有一段代码如下(使用 python 2.7.12 运行): self.config = ConfigParser() self.config.read(self.config_file) 其中 se
DeprecationWarning、PendingDeprecationWarning 和 FutureWarning 之间有什么区别?我在Python 3 documentation中看到目标“受
我是一名优秀的程序员,十分优秀!