MCPcopy Create free account
hub / github.com/pytest-dev/pytest / __enter__

Method __enter__

src/_pytest/recwarn.py:202–211  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

200 # Type ignored because it doesn't exactly warnings.catch_warnings.__enter__
201 # -- it returns a List but we only emulate one.
202 def __enter__(self) -> "WarningsRecorder": # type: ignore
203 if self._entered:
204 __tracebackhide__ = True
205 raise RuntimeError("Cannot enter %r twice" % self)
206 _list = super().__enter__()
207 # record=True means it's None.
208 assert _list is not None
209 self._list = _list
210 warnings.simplefilter("always")
211 return self
212
213 def __exit__(
214 self,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected