From 49362bfb36e3d69d2f9e86c6a8c8a6f771bd3f39 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Thu, 28 Feb 2019 13:21:22 +0000 Subject: [PATCH 1/3] Added failing test_logging.py --- src/rez/tests/test_logging.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/rez/tests/test_logging.py diff --git a/src/rez/tests/test_logging.py b/src/rez/tests/test_logging.py new file mode 100644 index 000000000..2ece20dbf --- /dev/null +++ b/src/rez/tests/test_logging.py @@ -0,0 +1,27 @@ +""" +test importing logging modules. + +Mostly for +""" +from rez.tests.util import TestBase +import rez.vendor.unittest2 as unittest +from rez.utils import logging_ + + +class TestLogging(TestBase): + + def test_print(self): + """Test valid msg and nargs combinations for print_*.""" + for msg in ("Hello", "Hello %s", "Hello %s %s"): + logging_.print_debug(msg) + logging_.print_info(msg) + logging_.print_warning(msg) + logging_.print_error(msg) + logging_.print_critical(msg) + + for nargs in ([], ["foo"], ["foo", "bar"]): + logging_.print_debug(msg, *nargs) + logging_.print_info(msg, *nargs) + logging_.print_warning(msg, *nargs) + logging_.print_error(msg, *nargs) + logging_.print_critical(msg, *nargs) From 9c94c200687291ad29460116487d5e384715a46e Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Thu, 28 Feb 2019 13:23:25 +0000 Subject: [PATCH 2/3] Fixed print_* in logging_ --- src/rez/utils/logging_.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rez/utils/logging_.py b/src/rez/utils/logging_.py index 80a073f27..117d8bed5 100644 --- a/src/rez/utils/logging_.py +++ b/src/rez/utils/logging_.py @@ -7,23 +7,23 @@ def print_debug(msg, *nargs): - logger.debug(msg % nargs) + logger.debug(msg, nargs) def print_info(msg, *nargs): - logger.info(msg % nargs) + logger.info(msg, nargs) def print_warning(msg, *nargs): - logger.warning(msg % nargs) + logger.warning(msg, nargs) def print_error(msg, *nargs): - logger.error(msg % nargs) + logger.error(msg, nargs) def print_critical(msg, *nargs): - logger.critical(msg % nargs) + logger.critical(msg, nargs) def get_debug_printer(enabled=True): From 4b0a97936003b4a47f3eade7ec48df7c1d03d0a9 Mon Sep 17 00:00:00 2001 From: Joseph Yu Date: Tue, 5 Mar 2019 13:08:07 +0000 Subject: [PATCH 3/3] Fixed nargs not expanded --- src/rez/utils/logging_.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rez/utils/logging_.py b/src/rez/utils/logging_.py index 117d8bed5..d5cd41918 100644 --- a/src/rez/utils/logging_.py +++ b/src/rez/utils/logging_.py @@ -7,23 +7,23 @@ def print_debug(msg, *nargs): - logger.debug(msg, nargs) + logger.debug(msg, *nargs) def print_info(msg, *nargs): - logger.info(msg, nargs) + logger.info(msg, *nargs) def print_warning(msg, *nargs): - logger.warning(msg, nargs) + logger.warning(msg, *nargs) def print_error(msg, *nargs): - logger.error(msg, nargs) + logger.error(msg, *nargs) def print_critical(msg, *nargs): - logger.critical(msg, nargs) + logger.critical(msg, *nargs) def get_debug_printer(enabled=True):