source: loggingpy/test/tudelft_utilities_logging/ReportToLoggerTest.py@ 888

Last change on this file since 888 was 225, checked in by wouter, 4 years ago

remove wrong dependency on old library

File size: 873 bytes
Line 
1import logging
2import unittest
3
4from tudelft_utilities_logging.ReportToLogger import ReportToLogger
5
6
7class ReportToLoggerTest(unittest.TestCase):
8 def testSmoke(self):
9 ReportToLogger("test")
10
11 def testLogException(self):
12 logger=ReportToLogger("test")
13 # manually check that logged stacktrace originates from makeExc
14 logger.log(logging.CRITICAL, "serious test", self.makeExc(3) )
15
16 def testLogNoException(self):
17
18 logger=ReportToLogger("test")
19 # manually check that logged stacktrace originates from makeExc
20 logger.log(logging.WARNING, "a minor warning", None )
21
22 def makeExc(self, depth:int):
23 if depth>0:
24 return self.makeExc(depth-1)
25 else:
26 try:
27 raise ValueError("blabla")
28 except Exception as e:
29 return e
Note: See TracBrowser for help on using the repository browser.