MCPcopy Index your code
hub / github.com/RustPython/RustPython / __exit__

Method __exit__

Lib/unittest/_log.py:62–85  ·  view source on GitHub ↗
(self, exc_type, exc_value, tb)

Source from the content-addressed store, hash-verified

60 return handler.watcher
61
62 def __exit__(self, exc_type, exc_value, tb):
63 self.logger.handlers = self.old_handlers
64 self.logger.propagate = self.old_propagate
65 self.logger.setLevel(self.old_level)
66
67 if exc_type is not None:
68 # let unexpected exceptions pass through
69 return False
70
71 if self.no_logs:
72 # assertNoLogs
73 if len(self.watcher.records) > 0:
74 self._raiseFailure(
75 "Unexpected logs found: {!r}".format(
76 self.watcher.output
77 )
78 )
79
80 else:
81 # assertLogs
82 if len(self.watcher.records) == 0:
83 self._raiseFailure(
84 "no logs of level {} or higher triggered on {}"
85 .format(logging.getLevelName(self.level), self.logger.name))

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
_raiseFailureMethod · 0.80
setLevelMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected