pytest-freezegun
Wrap tests with fixtures in freeze_time
Decision gist · record as of 2026-08-14
Yes, if your project is on a stable pytest and Python version and you need straightforward time-freezing in tests. No, if you require active maintenance or compatibility with recent pytest/Python releases—the package is abandoned and may break with newer versions. Consider it a low-risk, low-friction addition to an established test suite, but not a foundation for new projects expecting long-term support.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with only two runtime dependencies (freezegun and pytest).
- However, the package is abandoned—last release was 2020-07-19 and last commit 2023-03-28—so it will not receive bug fixes or updates for newer Python or pytest versions.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions, though you must include the license notice.
last release 2020-07-19 (2217 days) · last repo commit 2023-03-28 · 196 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,437,061 downloads/mo, #3,899 on PyPI
Alternatives
Verify before relying
pip install pytest-freezegun
import pytest
from datetime import datetime
def test_frozen_date(freezer):
now = datetime.now()
freezer.move_to('2017-05-20')
later = datetime.now()
assert now != later- Whether the package works reliably with pytest versions released after 2020-07-19
- Compatibility with Python versions beyond 3.8 (classifiers list only up to 3.8)
What it is and what it does
pytest-freezegun is a pytest plugin that integrates freezegun's time-freezing capability into the pytest testing framework. It provides a `freezer` fixture that you can inject into test functions to freeze and manipulate the system clock, and a `@pytest.mark.freeze_time` decorator for marking tests that should run with time frozen. This is useful when testing code that depends on the current date or time—you can freeze time at a specific moment, advance it, or move to a different date entirely, all within a single test, ensuring reproducible and deterministic behavior.
The plugin works with both function-based and class-based tests, integrates with other fixtures, and allows you to pass arguments to freezegun via the decorator. Because it depends on freezegun and pytest, you need both installed. The package is no longer actively maintained, with the last release in 2020 and no updates since then, so it may have compatibility issues with recent versions of pytest or Python.
Use it for
- Test code that checks if a deadline has passed by freezing time at a specific date and asserting the expected behavior.
- Verify that scheduled tasks trigger correctly by advancing frozen time and checking task execution.
- Test time-dependent calculations (e.g., age, interest accrual) by setting the clock to known dates.
- Ensure that retry logic with exponential backoff works as expected by controlling time progression.
- Test timezone-aware datetime handling by freezing time at specific moments across different zones.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if your project is on a stable pytest and Python version and you need straightforward time-freezing in tests.
No, if you require active maintenance or compatibility with recent pytest/Python releases—the package is abandoned and may break with newer versions. Consider it a low-risk, low-friction addition to an established test suite, but not a foundation for new projects expecting long-term support.
Install
pytest-freezegun on PyPI
Before you install
Low install friction with only two runtime dependencies (freezegun and pytest). However, the package is abandoned—last release was 2020-07-19 and last commit 2023-03-28—so it will not receive bug fixes or updates for newer Python or pytest versions.
License in practice
MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions, though you must include the license notice.
Quickstart
pip install pytest-freezegun
import pytest
from datetime import datetime
def test_frozen_date(freezer):
now = datetime.now()
freezer.move_to('2017-05-20')
later = datetime.now()
assert now != later
Verify before relying
- Whether the package works reliably with pytest versions released after 2020-07-19
- Compatibility with Python versions beyond 3.8 (classifiers list only up to 3.8)
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesfreezegunpytest |
| Maintenance | Abandoned 2,217 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,437,061 / month, #3,899 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing |
Evidence: pytest_freezegun-0.4.2-py2.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 › “pytest time freezing”
- pytest-freezegunpytest-freezegun provides a pytest plugin that freezes time in tests…
- pytest-pgsqlA pytest plugin that provides fixtures for running tests against…
- pytest-freezerpytest-freezer provides a pytest fixture that freezes system time…
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 freezegun · pytest-freezer · time-machine · pytest-socket · pytest-pgsql · pytest-datafiles · pytest-replay · pytest-logging · pytest-threadleak · pytest-regressions