MCPcopy Create free account
hub / github.com/tox-dev/filelock / steady_clock

Function steady_clock

tests/core/test_timeout.py:133–142  ·  view source on GitHub ↗
(mocker: MockerFixture)

Source from the content-addressed store, hash-verified

131
132@pytest.fixture
133def steady_clock(mocker: MockerFixture) -> MockType:
134 # Advancing 10 ms per read keeps the first poll inside the timeout even on a loaded runner.
135 sleep_mock = mocker.create_autospec(time.sleep)
136 clock = SimpleNamespace(
137 perf_counter=mocker.create_autospec(time.perf_counter, side_effect=(reading / 100 for reading in count())),
138 sleep=sleep_mock,
139 )
140 mocker.patch("filelock._core._state.time", new=clock)
141 mocker.patch("filelock._core._acquire.time", new=clock)
142 return sleep_mock
143
144
145@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected