Last change
on this file since 831 was 225, checked in by wouter, 3 years ago |
remove wrong dependency on old library
|
File size:
873 bytes
|
Line | |
---|
1 | import logging
|
---|
2 | import unittest
|
---|
3 |
|
---|
4 | from tudelft_utilities_logging.ReportToLogger import ReportToLogger
|
---|
5 |
|
---|
6 |
|
---|
7 | class 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.