From 7dab7c3b6a4c5d8ad389102bb4a8dfbbe633caf8 Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen Date: Sat, 15 Dec 2018 19:44:26 +0800 Subject: [PATCH] Get rid of warnings from logging.warn logging.warn is deprecated [1]. [1] https://docs.python.org/3/library/logging.html#logging.Logger.warning --- nvchecker/core.py | 2 +- nvchecker/source/regex.py | 2 +- nvchecker/tools.py | 2 +- tests/conftest.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nvchecker/core.py b/nvchecker/core.py index cd6dd86..6b26f73 100644 --- a/nvchecker/core.py +++ b/nvchecker/core.py @@ -189,7 +189,7 @@ class Source: else: conf = config[name] if not conf.getboolean('missing_ok', False): - logger.warn('no-result', name=name) + logger.warning('no-result', name=name) self.on_no_result(name) if self.newver: diff --git a/nvchecker/source/regex.py b/nvchecker/source/regex.py index ac61fd5..7df73c9 100644 --- a/nvchecker/source/regex.py +++ b/nvchecker/source/regex.py @@ -14,7 +14,7 @@ async def get_version(name, conf, **kwargs): try: regex = re.compile(conf['regex']) except sre_constants.error: - logger.warn('bad regex, skipped.', name=name, exc_info=True) + logger.warning('bad regex, skipped.', name=name, exc_info=True) return encoding = conf.get('encoding', 'latin1') diff --git a/nvchecker/tools.py b/nvchecker/tools.py index 1e44497..4d77912 100644 --- a/nvchecker/tools.py +++ b/nvchecker/tools.py @@ -42,7 +42,7 @@ def take(): oldvers[name] = newvers[name] except KeyError: if args.ignore_nonexistent: - logger.warn('nonexistent in newver, ignored', name=name) + logger.warning('nonexistent in newver, ignored', name=name) continue logger.critical( diff --git a/tests/conftest.py b/tests/conftest.py index 9f6831e..39e11f7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -62,7 +62,7 @@ def event_loop(request): @pytest.fixture(scope="session", autouse=True) def raise_on_logger_msg(): def proc(logger, method_name, event_dict): - if method_name in ('warn', 'error'): + if method_name in ('warning', 'error'): if 'exc_info' in event_dict: raise event_dict['exc_info'] raise RuntimeError(event_dict['event'])