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

Last change on this file since 839 was 225, checked in by wouter, 3 years ago

remove wrong dependency on old library

File size: 873 bytes
RevLine 
[207]1import logging
[204]2import unittest
[207]3
4from tudelft_utilities_logging.ReportToLogger import ReportToLogger
5
6
[204]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.