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

Method _remove_unittest_tb_frames

Lib/unittest/result.py:241–254  ·  view source on GitHub ↗

Truncates usercode tb at the first unittest frame. If the first frame of the traceback is in user code, the prefix up to the first unittest frame is returned. If the first frame is already in the unittest module, the traceback is not modified.

(self, tb)

Source from the content-addressed store, hash-verified

239 return '__unittest' in tb.tb_frame.f_globals
240
241 def _remove_unittest_tb_frames(self, tb):
242 '''Truncates usercode tb at the first unittest frame.
243
244 If the first frame of the traceback is in user code,
245 the prefix up to the first unittest frame is returned.
246 If the first frame is already in the unittest module,
247 the traceback is not modified.
248 '''
249 prev = None
250 while tb and not self._is_relevant_tb_level(tb):
251 prev = tb
252 tb = tb.tb_next
253 if prev is not None:
254 prev.tb_next = None
255
256 def __repr__(self):
257 return ("<%s run=%i errors=%i failures=%i>" %

Callers 1

_clean_tracebacksMethod · 0.95

Calls 1

_is_relevant_tb_levelMethod · 0.95

Tested by

no test coverage detected