Be more strict about Python deprecation warnings again

The warnings caught in earlyinit.py got fixed in the affected dependencies.
The collections.abc warning also seems to be fixed in everything but PyYAML.
This commit is contained in:
Florian Bruhin 2019-02-16 20:10:29 +01:00
parent 94f998ac3a
commit 5a319cc505
3 changed files with 10 additions and 22 deletions

View File

@ -68,7 +68,5 @@ qt_log_ignore =
xfail_strict = true
filterwarnings =
error
# This happens in many qutebrowser dependencies...
ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working:DeprecationWarning
# WORKAROUND for https://github.com/pytest-dev/pytest-bdd/pull/288
ignore:the `pytest\.config` global is deprecated\. Please use `request.config` or `pytest_configure` \(if you're a pytest plugin\) instead\.

View File

@ -199,25 +199,7 @@ def _check_modules(modules):
for name, text in modules.items():
try:
# https://github.com/pallets/jinja/pull/628
# https://bitbucket.org/birkenfeld/pygments-main/issues/1314/
# https://github.com/pallets/jinja/issues/646
# https://bitbucket.org/fdik/pypeg/commits/dd15ca462b532019c0a3be1d39b8ee2f3fa32f4e
messages = ['invalid escape sequence',
'Flags not at the start of the expression']
# pylint: disable=bad-continuation
with log.ignore_py_warnings(
category=DeprecationWarning,
message=r'({})'.format('|'.join(messages))
), log.ignore_py_warnings(
category=PendingDeprecationWarning,
module='imp'
), log.ignore_py_warnings(
category=ImportWarning,
message=r'Not importing directory .*: missing __init__'
):
# pylint: enable=bad-continuation
importlib.import_module(name)
importlib.import_module(name)
except ImportError as e:
_die(text, e)

View File

@ -655,7 +655,15 @@ def expand_windows_drive(path):
def yaml_load(f):
"""Wrapper over yaml.load using the C loader if possible."""
start = datetime.datetime.now()
data = yaml.load(f, Loader=YamlLoader)
# WORKAROUND for https://github.com/yaml/pyyaml/pull/181
with log.ignore_py_warnings(
category=DeprecationWarning,
message=r"Using or importing the ABCs from 'collections' instead "
r"of from 'collections\.abc' is deprecated, and in 3\.8 it will "
r"stop working"):
data = yaml.load(f, Loader=YamlLoader)
end = datetime.datetime.now()
delta = (end - start).total_seconds()