gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-taler-util] 32/51: 4453. Testing mixed situation,


From: gnunet
Subject: [GNUnet-SVN] [taler-taler-util] 32/51: 4453. Testing mixed situation,
Date: Mon, 23 Sep 2019 22:02:23 +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 0261b50883f2af70ca346544edae03fac33b33db
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Feb 7 14:39:21 2019 +0100

    4453.  Testing mixed situation,
    
    with manual loglevel setup and forced env.
---
 python/log/test_ut.py | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/python/log/test_ut.py b/python/log/test_ut.py
index 83086e1..0eaa121 100755
--- a/python/log/test_ut.py
+++ b/python/log/test_ut.py
@@ -66,7 +66,7 @@ class TestGnunetLog(TestCase):
         assert None == os.environ.get("GNUNET_FORCE_LOG")
         assert None == os.environ.get("GNUNET_LOG")
         gl = GL("gnunet-pylog")
-        gl.log("msg", gl.INFO)
+        gl.log("msg", gl.DEBUG)
         mocked_setLevel.assert_called_with(level=logging.INFO)
 
 
@@ -102,6 +102,26 @@ class TestGnunetLog(TestCase):
         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)
+        gl.setup(gl.ERROR)
+        gl.log("msg", gl.DEBUG)
+        mocked_setLevel.assert_called_with(level=logging.ERROR)
+
+
+    # This function tests the case where *both* the manual loglevel
+    # and the forced env variable are setup; the expected result is
+    # that the forced variable wins over the manual setup.
+    @patch("logging.Logger.setLevel")
+    @patch("logging.basicConfig")
+    def test_manual_loglevel_AND_forced_env(self, mocked_basicConfig, 
mocked_setLevel):
+        assert None == os.environ.get("GNUNET_LOG")
+        assert None == os.environ.get("GNUNET_FORCE_LOG")
+
+        # forced env definition (*before* object creation)
+        os.environ["GNUNET_FORCE_LOG"] = ";;;;ERROR"
+        gl = GL("gnunet-pylog")
+
+        # manual setup
+        gl.setup(gl.WARNING)
+
+        gl.log("msg", gl.DEBUG)
+        mocked_setLevel.assert_called_with(level=logging.ERROR)

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]