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

Class MockTiming

testing/conftest.py:197–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195
196 @attr.s
197 class MockTiming:
198
199 _current_time = attr.ib(default=1590150050.0)
200
201 def sleep(self, seconds):
202 self._current_time += seconds
203
204 def time(self):
205 return self._current_time
206
207 def patch(self):
208 from _pytest import timing
209
210 monkeypatch.setattr(timing, "sleep", self.sleep)
211 monkeypatch.setattr(timing, "time", self.time)
212 monkeypatch.setattr(timing, "perf_counter", self.time)
213
214 result = MockTiming()
215 result.patch()

Callers 1

mock_timingFunction · 0.85

Calls

no outgoing calls

Tested by 1

mock_timingFunction · 0.68