File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44"""
55
66import unittest
7- from mock import patch
7+ from mock import patch , Mock
88from bases import ClearEnvTest
99
1010import os
@@ -91,7 +91,19 @@ def test_get_logger_defaults(self):
9191 self .assertEqual (handler .queue .maxsize , stackify .QUEUE_SIZE )
9292
9393 def test_get_logger_reuse (self ):
94- pass
94+ '''Grabbing a logger twice results in the same logger'''
95+ logger = stackify .getLogger (config = self .config , auto_shutdown = False )
96+ self .loggers .append (logger )
97+ logger_two = stackify .getLogger (config = self .config , auto_shutdown = False )
98+ self .assertEqual (id (logger_two ), id (logger ))
99+
100+ def test_logger_atexit (self ):
101+ '''Logger registers an atexit function to clean up'''
102+ func = Mock ()
103+ with patch ('atexit.register' , func ):
104+ logger = stackify .getLogger (config = self .config )
105+ self .loggers .append (logger )
106+ func .assert_called_with (stackify .stopLogging , logger )
95107
96108
97109if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments