MCPcopy
hub / github.com/pytest-dev/pytest / patch

Method patch

src/_pytest/timing.py:88–94  ·  view source on GitHub ↗
(self, monkeypatch: MonkeyPatch)

Source from the content-addressed store, hash-verified

86 return self._current_time
87
88 def patch(self, monkeypatch: MonkeyPatch) -> None:
89 # pylint: disable-next=import-self
90 from _pytest import timing # noqa: PLW0406
91
92 monkeypatch.setattr(timing, "sleep", self.sleep)
93 monkeypatch.setattr(timing, "time", self.time)
94 monkeypatch.setattr(timing, "perf_counter", self.time)
95
96
97__all__ = ["perf_counter", "sleep", "time"]

Callers 5

mock_timingFunction · 0.95

Calls 1

setattrMethod · 0.80

Tested by 5

mock_timingFunction · 0.76