Freezegun

Time-machine vs Freezegun

Compare time-machine and freezegun for mocking time in Python tests. Learn their key differences, performance, and how to choose the best tool for your project.

Node.js
Freezegun
Guides · Better Stack ·  Updated on April 25, 2025

A Beginner's Guide to Unit Testing with Freezegun

Learn how to use Freezegun, a Python library for freezing and simulating time in tests. This step-by-step guide covers setup, time-freezing, advancing time, auto-tick, and testing across time zones using `pytest`. Perfect for writing reliable tests for time-sensitive code.

Python
Freezegun
Guides · Better Stack ·  Updated on April 3, 2025