MCPcopy Create free account
hub / github.com/hynek/structlog / test_ignores_frames

Method test_ignores_frames

tests/test_stdlib.py:94–113  ·  view source on GitHub ↗

The name guesser walks up the frames until it reaches a frame whose name is not from structlog or one of the configurable other names.

(self)

Source from the content-addressed store, hash-verified

92 assert "tests.test_stdlib" == LoggerFactory()().name
93
94 def test_ignores_frames(self):
95 """
96 The name guesser walks up the frames until it reaches a frame whose
97 name is not from structlog or one of the configurable other names.
98 """
99
100 # Compute the names to __main__ so it doesn't get thrown off if people
101 # install plugins that alter the frames. E.g. #370
102 names = set()
103 f = sys._getframe()
104 while f.f_globals["__name__"] != "__main__":
105 names.add(f.f_globals["__name__"].split(".", 1)[0])
106 f = f.f_back
107
108 assert (
109 "__main__"
110 == additional_frame(
111 LoggerFactory(ignore_frame_names=list(names))
112 ).name
113 )
114
115 def test_deduces_correct_caller(self):
116 """

Callers

nothing calls this directly

Calls 2

additional_frameFunction · 0.90
LoggerFactoryClass · 0.90

Tested by

no test coverage detected