Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 1, 2026

Bumps time-machine from 2.14.1 to 3.2.0.

Changelog

Sourced from time-machine's changelog.

3.2.0 (2025-12-17)

  • Add :attr:time_machine.naive_mode to control how time-machine interprets naive datetimes.

    The default mode is MIXED, which preserves existing behaviour: naive datetime objects and date objects are interpreted as UTC, while naive datetime strings are interpreted as local time.

    Three alternative modes are available:

    • UTC: naive datetimes are always interpreted as UTC.
    • LOCAL: naive datetimes are interpreted as local time, matching Python's default semantics, and freezegun.
    • ERROR: naive datetimes raise a RuntimeError, ensuring your tests are isolated from the current timezone.

    .. note::

    It’s recommended you use LOCAL or ERROR to avoid confusion around naive datetimes.

    PR [#591](https://github.com/adamchainz/time-machine/issues/591) <https://github.com/adamchainz/time-machine/pull/591>__. Thanks to Paolo Melchiorre for review.

    Thanks to PhML, Stefaan Lippens, Matthieu Rigal, Nikita Demir, Steve Mavens, Andy Freeland, and Paul Ganssle for their input on Issue [#257](https://github.com/adamchainz/time-machine/issues/257) <https://github.com/adamchainz/time-machine/issues/257>__.

  • Raise RuntimeError when attempting to start time travelling if freezegun <https://pypi.org/project/freezegun/>__ is active.

    This change should help avoid surprises when migrating complex test suites from freezegun to time-machine.

    PR [#590](https://github.com/adamchainz/time-machine/issues/590) <https://github.com/adamchainz/time-machine/pull/590>__.

3.1.0 (2025-11-21)

  • Optimize patching of uuid module. By avoiding using unittest.mock, this small overhead from starting time_machine.travel() has been reduced about 20x, from ~600ns to ~30ns by one benchmark.

    PR [#585](https://github.com/adamchainz/time-machine/issues/585) <https://github.com/adamchainz/time-machine/pull/585>__.

3.0.0 (2025-11-18)

  • Remove mocking of time.monotonic() and time.monotonic_ns().

    This mocking caused too many issues, such as causing freezes in asyncio event loops (Issue [#387](https://github.com/adamchainz/time-machine/issues/387) <https://github.com/adamchainz/time-machine/issues/387>), preventing pytest-durations from timing tests correctly (Issue [#505](https://github.com/adamchainz/time-machine/issues/505) <https://github.com/adamchainz/time-machine/issues/505>), and triggering timeouts in psycopg (Issue [#509](https://github.com/adamchainz/time-machine/issues/509) <https://github.com/adamchainz/time-machine/issues/509>__). 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.

    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 monotonic() or monotonic_ns() directly, so that your tests can mock it in those places only. For example, if your system under test looks like:

    .. |unittest.mock| replace:: unittest.mock __ https://docs.python.org/3/library/unittest.mock.html

... (truncated)

Commits

Dependabot compatibility score

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 commands and options

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)

Bumps [time-machine](https://github.com/adamchainz/time-machine) from 2.14.1 to 3.2.0.
- [Changelog](https://github.com/adamchainz/time-machine/blob/main/docs/changelog.rst)
- [Commits](adamchainz/time-machine@2.14.1...3.2.0)

---
updated-dependencies:
- dependency-name: time-machine
  dependency-version: 3.2.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file Major issue that requires attention python Pull requests that update Python code labels Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file Major issue that requires attention python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant