Commit fd527c5
authored
Bump time-machine from 2.19.0 to 3.1.0 (#230)
Bumps [time-machine](https://github.com/adamchainz/time-machine) from
2.19.0 to 3.1.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/adamchainz/time-machine/blob/main/docs/changelog.rst">time-machine's
changelog</a>.</em></p>
<blockquote>
<h2>3.1.0 (2025-11-21)</h2>
<ul>
<li>
<p>Optimize patching of <code>uuid</code> module.
By avoiding using <code>unittest.mock</code>, this small overhead from
starting <code>time_machine.travel()</code> has been reduced about 20x,
from ~600ns to ~30ns by one benchmark.</p>
<p><code>PR
[#585](adamchainz/time-machine#585)
<https://github.com/adamchainz/time-machine/pull/585></code>__.</p>
</li>
</ul>
<h2>3.0.0 (2025-11-18)</h2>
<ul>
<li>
<p>Remove mocking of <code>time.monotonic()</code> and
<code>time.monotonic_ns()</code>.</p>
<p>This mocking caused too many issues, such as causing freezes in
asyncio event loops (<code>Issue
[#387](adamchainz/time-machine#387)
<https://github.com/adamchainz/time-machine/issues/387></code><strong>),
preventing pytest-durations from timing tests correctly (<code>Issue
[#505](adamchainz/time-machine#505)
<https://github.com/adamchainz/time-machine/issues/505></code></strong>),
and triggering timeouts in psycopg (<code>Issue
[#509](adamchainz/time-machine#509)
<https://github.com/adamchainz/time-machine/issues/509></code>__).
The root cause here is that mocking the monotonic clock breaks its
contract, allowing it to move backwards when it’s meant to only move
forwards.</p>
<p>As an alternative, use |unittest.mock|__ to mock the monotonic
function for the specific tested modules that need it.
That means that your code should import <code>monotonic()</code> or
<code>monotonic_ns()</code> directly, so that your tests can mock it in
those places only.
For example, if your system under test looks like:</p>
<p>.. |unittest.mock| replace:: <code>unittest.mock</code>
__ <a
href="https://docs.python.org/3/library/unittest.mock.html">https://docs.python.org/3/library/unittest.mock.html</a></p>
<p>.. code-block:: python</p>
<pre><code># example.py
from time import monotonic
<p>def measurement():
start = monotonic()
...
end = monotonic()
return end - start
</code></pre></p>
<p>…then your tests can mock <code>monotonic()</code> like this:</p>
<p>.. code-block:: python</p>
<pre><code>from unittest import TestCase, mock
<p>import example</p>
<p>class MeasurementTests(TestCase):
def test_success(self):
with mock.patch.object(example, "monotonic", side_effect=[0.0,
1.23]):
result = example.measurement()
assert result == 1.23
</code></pre></p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/adamchainz/time-machine/commit/b9f7500d03de270766fcfaf694f4beccf57eae5e"><code>b9f7500</code></a>
Version 3.1.0</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/965e906ec5b7acbeb348cf1dc85252918aa79f9e"><code>965e906</code></a>
Optimize patching of uuid module (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/585">#585</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/5d2e8dd4a427988e53d8fcce74b717dd4d0f9538"><code>5d2e8dd</code></a>
Version 3.0.0</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/39ba19f3409b6ab32e04fc5ed10016efa85b7675"><code>39ba19f</code></a>
Upgrade cibuildwheel to 3.3.0 (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/581">#581</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/3a0d5dd43e440761bfff4696856db301cf189560"><code>3a0d5dd</code></a>
Raise ValueError from escape_hatch functions when not travelling (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/580">#580</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/ac23916b4d37d838d04fbb0709d76ed50e7113e2"><code>ac23916</code></a>
Improve usage documentation (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/579">#579</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/d10f0003cd619636de38373f774759e84e6ce3ac"><code>d10f000</code></a>
Parse str destinations with datetime.fromisoformat() first (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/578">#578</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/b82045133a6414e84c4521c5d50322861026d62f"><code>b820451</code></a>
Reorder changelog</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/48f1af50f646198196c6d7ed7a14f7f23ed88482"><code>48f1af5</code></a>
Make dateutil an optional dependency (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/576">#576</a>)</li>
<li><a
href="https://github.com/adamchainz/time-machine/commit/5559f89b6d61cf4156f64eb87919a7fdd2477b4e"><code>5559f89</code></a>
Remove Python 3.9 from cibuildwheel target list (<a
href="https://redirect.github.com/adamchainz/time-machine/issues/575">#575</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/adamchainz/time-machine/compare/2.19.0...3.1.0">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>File tree
3 files changed
+22
-22
lines changed- tests
3 files changed
+22
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
| 313 | + | |
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
| 356 | + | |
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| |||
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
403 | | - | |
| 403 | + | |
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
| 450 | + | |
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
| |||
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
506 | | - | |
| 506 | + | |
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| |||
545 | 545 | | |
546 | 546 | | |
547 | 547 | | |
548 | | - | |
| 548 | + | |
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
| |||
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
589 | | - | |
| 589 | + | |
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
| 667 | + | |
668 | 668 | | |
669 | 669 | | |
670 | 670 | | |
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
737 | | - | |
| 737 | + | |
738 | 738 | | |
739 | 739 | | |
740 | 740 | | |
| |||
831 | 831 | | |
832 | 832 | | |
833 | 833 | | |
834 | | - | |
| 834 | + | |
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | | - | |
| 324 | + | |
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
420 | | - | |
| 420 | + | |
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
| |||
0 commit comments