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

Method pop

src/_pytest/recwarn.py:188–194  ·  view source on GitHub ↗

Pop the first recorded warning, raise exception if not exists.

(self, cls: Type[Warning] = Warning)

Source from the content-addressed store, hash-verified

186 return len(self._list)
187
188 def pop(self, cls: Type[Warning] = Warning) -> "warnings.WarningMessage":
189 """Pop the first recorded warning, raise exception if not exists."""
190 for i, w in enumerate(self._list):
191 if issubclass(w.category, cls):
192 return self._list.pop(i)
193 __tracebackhide__ = True
194 raise AssertionError("%r not found in warning list" % cls)
195
196 def clear(self) -> None:
197 """Clear the list of recorded warnings."""

Callers 15

test_recordingMethod · 0.95
finalizeMethod · 0.80
import_pathFunction · 0.80
insert_missing_modulesFunction · 0.80
assert_containsMethod · 0.80
inline_runMethod · 0.80
runpytest_inprocessMethod · 0.80
_match_linesMethod · 0.80
pytest_collectreportMethod · 0.80
rewriteMethod · 0.80
_printcollecteditemsMethod · 0.80

Calls

no outgoing calls