summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2024-07-23 23:21:23 +0200
committerGitHub <noreply@github.com>2024-07-23 23:21:23 +0200
commitcd105d479a745041c571a819e9fedab146783b1e (patch)
tree5603053f1b5975eb34b76ea82d6a15c229d90c61 /test
parentAdded info about MacOS targets for cron module (#83620) (diff)
downloadansible-cd105d479a745041c571a819e9fedab146783b1e.tar.xz
ansible-cd105d479a745041c571a819e9fedab146783b1e.zip
display: warn user about empty log path value (#83381)
Fixes: #79959 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/units/utils/display/test_logger.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/units/utils/display/test_logger.py b/test/units/utils/display/test_logger.py
index 8767affba3..b3203f8cff 100644
--- a/test/units/utils/display/test_logger.py
+++ b/test/units/utils/display/test_logger.py
@@ -28,3 +28,19 @@ def test_logger():
from ansible.utils.display import logger
assert logger.root.level != logging.DEBUG
+
+
+def test_empty_logger():
+ # clear loaded modules to have unadultered test.
+ for loaded in list(sys.modules.keys()):
+ if 'ansible' in loaded:
+ del sys.modules[loaded]
+
+ # force logger to exist via config
+ from ansible import constants as C
+ C.DEFAULT_LOG_PATH = ''
+
+ # initialize logger
+ from ansible.utils.display import logger
+
+ assert logger is None