freezegun
Let your Python tests travel through time
Decision gist · record as of 2026-08-14
Yes. FreezeGun is a mature, widely-used testing utility with no known vulnerabilities, permissive licensing, and low install friction. It solves a real problem—making time-dependent tests deterministic—and is the de facto standard for this in Python. The aging maintenance status reflects stability rather than abandonment; the last commit was recent and the repository is active.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with a single runtime dependency (python-dateutil).
- Last release was recent (2025-08-09), though the project shows aging maintenance status with no release for 370 days prior.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2025-08-09 (370 days) · last repo commit 2025-08-19 · 4,522 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 60,817,178 downloads/mo, #500 on PyPI
Alternatives
Verify before relying
pip install freezegun
from freezegun import freeze_time
import datetime
@freeze_time("2012-01-14")
def test_frozen():
assert datetime.datetime.now() == datetime.datetime(2012, 1, 14)- Whether the 370-day gap before the latest release indicates ongoing maintenance or a stable, feature-complete state
What it is and what it does
FreezeGun intercepts calls to datetime.datetime.now(), datetime.date.today(), time.time(), time.monotonic(), and related time functions, returning a fixed or controlled time instead. This lets you write deterministic tests for time-dependent code without waiting for real time to pass or dealing with flaky assertions based on system clock.
You apply it as a decorator on test functions or classes, wrap code in a context manager, or call start/stop manually. It supports timezone offsets, manual time advancement (tick), automatic time progression (auto_tick_seconds), and even generator-based time sequences. The library uses python-dateutil to parse human-readable date strings like "Jan 14th, 2012" in addition to ISO formats.
Use it for
- Test code that checks if a deadline has passed or a timeout has expired without actually waiting
- Verify behavior at specific dates (e.g., leap years, daylight saving transitions) deterministically
- Mock time.monotonic() and time.perf_counter() to test timing-sensitive logic in unit tests
- Simulate time progression within a test by using tick() or auto_tick_seconds to advance the frozen clock
- Test scheduled tasks or cron-like behavior by freezing time at known points and advancing it step-by-step
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
FreezeGun is a mature, widely-used testing utility with no known vulnerabilities, permissive licensing, and low install friction. It solves a real problem—making time-dependent tests deterministic—and is the de facto standard for this in Python. The aging maintenance status reflects stability rather than abandonment; the last commit was recent and the repository is active.
Install
freezegun on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (python-dateutil). Last release was recent (2025-08-09), though the project shows aging maintenance status with no release for 370 days prior.
License in practice
Apache-2.0 is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install freezegun
from freezegun import freeze_time
import datetime
@freeze_time("2012-01-14")
def test_frozen():
assert datetime.datetime.now() == datetime.datetime(2012, 1, 14)
Verify before relying
- Whether the 370-day gap before the latest release indicates ongoing maintenance or a stable, feature-complete state
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepython-dateutil |
| Maintenance | Aging 370 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 60,817,178 / month, #500 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: freezegun-1.5.5-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “mock datetime in tests”
- freezegunFreezeGun mocks Python's datetime and time modules to let tests run…
- time-machineMocks and freezes time in tests, allowing you to travel to any point…
- testfixturesTestfixtures provides helpers and mock objects for writing unit and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also pytest-freezegun · time-machine · pytest-freezer · timeago · delorean · types-freezegun · fiscalyear · snaptime · ago · asyncmock