[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-taler-util] 31/51: 4453. Test only manual loglevel s
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-taler-util] 31/51: 4453. Test only manual loglevel setup. |
Date: |
Mon, 23 Sep 2019 22:02:22 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository taler-util.
commit b8165e39e441981e1de5f85e9871de443e7dbaae
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Feb 7 14:24:37 2019 +0100
4453. Test only manual loglevel setup.
---
python/log/test_ut.py | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/python/log/test_ut.py b/python/log/test_ut.py
index 2b973f5..83086e1 100755
--- a/python/log/test_ut.py
+++ b/python/log/test_ut.py
@@ -46,6 +46,11 @@ def clean_env():
if os.environ.get("GNUNET_FORCE_LOGFILE"):
del os.environ["GNUNET_FORCE_LOGFILE"]
+
+# NOTE: no logs will appear on screen, as the setLevel
+# function is mocked (and the level specified won't be
+# made effective -- rather, only the very default level
+# (WARNING) will apply)!
class TestGnunetLog(TestCase):
def setUp(self):
clean_env()
@@ -54,11 +59,6 @@ class TestGnunetLog(TestCase):
# env variable is set and no explicit loglevel is given
# via the "setup()" method. The expected result is that
# the level is set to INFO.
- #
- # NOTE: no logs will appear on screen, as the setLevel
- # function is mocked (and the level specified won't be
- # made effective -- rather, only the very default level
- # (WARNING) will apply)!
@patch("logging.Logger.setLevel")
@patch("logging.basicConfig")
def test_no_env_and_no_setup(self, mocked_basicConfig, mocked_setLevel):
@@ -81,3 +81,27 @@ class TestGnunetLog(TestCase):
gl = GL("gnunet-pylog")
gl.log("msg", gl.DEBUG)
mocked_setLevel.assert_called_with(level=logging.ERROR)
+
+ # This function tests the case where *only* the GNUNET_FORCE_LOG
+ # env variable is set -- not even the manual setup of the loglevel
+ # is put in place.
+ @patch("logging.Logger.setLevel")
+ @patch("logging.basicConfig")
+ def test_only_forced_env(self, mocked_basicConfig, mocked_setLevel):
+ assert None == os.environ.get("GNUNET_LOG")
+ os.environ["GNUNET_FORCE_LOG"] =
"gnunet-pylog;test_ut.py;test_only_forced_env;70-100;ERROR"
+ gl = GL("gnunet-pylog")
+ gl.log("msg", gl.DEBUG)
+ mocked_setLevel.assert_called_with(level=logging.ERROR)
+
+ # This function tests the case where *only* the manual
+ # loglevel setup is put in place.
+ @patch("logging.Logger.setLevel")
+ @patch("logging.basicConfig")
+ def test_only_manual_loglevel_setup(self, mocked_basicConfig,
mocked_setLevel):
+ assert None == os.environ.get("GNUNET_LOG")
+ assert None == os.environ.get("GNUNET_FORCE_LOG")
+ gl = GL("gnunet-pylog")
+ gl.setup(gl.DEBUG)
+ gl.log("msg", gl.WARNING)
+ mocked_setLevel.assert_called_with(level=logging.DEBUG)
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [taler-taler-util] 29/51: rename function, (continued)
- [GNUnet-SVN] [taler-taler-util] 29/51: rename function, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 30/51: Testing env var GNUNET_LOG., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 32/51: 4453. Testing mixed situation,, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 37/51: fix after file rename, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 38/51: 4453. Test GNUNET_FORCE_LOGFILE., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 50/51: Make tests work again., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 33/51: 4453. Test manual loglevel setup and nonforced env., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 27/51: syntax, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 34/51: 4453. Test for GNUNET_LOG and GNUNET_FORCE_LOG both defined., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 39/51: Log: fix line interval parsing (care about one number case.), gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 31/51: 4453. Test only manual loglevel setup.,
gnunet <=
- [GNUnet-SVN] [taler-taler-util] 28/51: Testing 4453 with unittest. First batch., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 43/51: Add a .dir-locals, el for configuring emacs for this project, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 44/51: ux, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 46/51: gitignore, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 36/51: Remove old test, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 45/51: rename., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 35/51: 4453. Fix GNUNET_FORCE_LOG priority., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 40/51: Doxygen-commenting gnunet_log.py, gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 41/51: Doxygen-comment logger test cases., gnunet, 2019/09/23
- [GNUnet-SVN] [taler-taler-util] 42/51: Importing the Doxygen-commented config from the bank., gnunet, 2019/09/23