Skip to content

Replace freezegun with time-machine - #4360

Merged
r4victor merged 1 commit into
masterfrom
pr_replace_freezegun_with_time_machine
Oct 9, 2026
Merged

r4victor merged 1 commit into
masterfrom
pr_replace_freezegun_with_time_machine

Conversation

@r4victor

@r4victor r4victor commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Fixes #4357. freezegun replaces datetime.datetime with FakeDatetime while frozen, which pydantic 2.14 can't build schemas for. time-machine patches the clock functions at the C level and keeps the real datetime class.

  • Replace freeze_time(X) with time_machine.travel(X, tick=False), and class-level @freeze_time with the @pytest.mark.time_machine marker.
  • Use get_current_datetime() instead of naive datetime.now() for gateway ChatModel.created_at, so the registry test doesn't depend on the local timezone.
  • Remove the FakeDatetime route schema warm-up from the server tests conftest.py.

freezegun swaps datetime.datetime for FakeDatetime, which pydantic 2.14 can't build schemas for (#4357).
@r4victor
r4victor merged commit b6aea14 into master Oct 9, 2026
26 checks passed
@r4victor
r4victor deleted the pr_replace_freezegun_with_time_machine branch October 9, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Tests fail with pydantic 2.14.0 and kubernetes 37.0.0 (freezegun)

1 participant