diff options
Diffstat (limited to 'tests/conftest.py')
-rw-r--r-- | tests/conftest.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index e09d7f1..84710ae 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,6 +9,8 @@ Note: The protocol ``http(s)+mock://`` helps :py:class:`requests_mock.Adapter` p https://requests-mock.readthedocs.io/en/latest/adapter.html """ import os +import warnings +from contextlib import contextmanager from datetime import datetime, timedelta from functools import wraps from importlib import import_module @@ -278,5 +280,13 @@ def skip_missing_deps(module_name: str) -> pytest.Mark: ) +@contextmanager +def ignore_deprecation(): + """Temporarily ilence deprecation warnings""" + with warnings.catch_warnings(): + warnings.simplefilter('ignore', category=DeprecationWarning) + yield + + # Some tests must disable url normalization to retain the custom `http+mock://` protocol patch_normalize_url = patch('requests_cache.cache_keys.normalize_url', side_effect=lambda x, y: x) |