summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2019-02-07 14:44:30 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2019-02-07 14:44:30 +0100
commitf08e4aa50250264c01937e008ef13d00f3fdaa9f (patch)
treea628338ee62082b3d3326b20e422aae565e4f464
parent0261b50883f2af70ca346544edae03fac33b33db (diff)
downloadtaler-util-f08e4aa50250264c01937e008ef13d00f3fdaa9f.tar.gz
taler-util-f08e4aa50250264c01937e008ef13d00f3fdaa9f.tar.bz2
taler-util-f08e4aa50250264c01937e008ef13d00f3fdaa9f.zip
4453. Test manual loglevel setup and nonforced env.
-rwxr-xr-xpython/log/test_ut.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/python/log/test_ut.py b/python/log/test_ut.py
index 0eaa121..6de55de 100755
--- a/python/log/test_ut.py
+++ b/python/log/test_ut.py
@@ -125,3 +125,18 @@ class TestGnunetLog(TestCase):
gl.log("msg", gl.DEBUG)
mocked_setLevel.assert_called_with(level=logging.ERROR)
+
+ # This function tests the case where *both* GNUNET_LOG and
+ # the manual loglevel setup are put in place. The expectation
+ # is that the manual loglevel wins.
+ @patch("logging.Logger.setLevel")
+ @patch("logging.basicConfig")
+ def test_manual_loglevel_AND_nonforced_env(self, mocked_basicConfig, mocked_setLevel):
+ assert None == os.environ.get("GNUNET_LOG")
+ assert None == os.environ.get("GNUNET_FORCE_LOG")
+ os.environ["GNUNET_LOG"] = ";;;;DEBUG"
+ gl = GL("gnunet-pylog")
+ gl.setup(gl.ERROR)
+
+ gl.log("msg", gl.DEBUG)
+ mocked_setLevel.assert_called_with(level=logging.ERROR)