freezegun

Mock datetime for testing time-sensitive code.

EstablishedOpen SourceLow lock-in

Pricing

Free tier

Flat rate

Adoption

Cooling

License

Open Source

Data freshness

Aging · Jun 8, 2026

Overview

What is freezegun?

FreezeGun allows developers to mock the datetime module in Python, making it easier to test and develop applications that depend on specific points in time. This is particularly useful for ensuring consistent behavior across different environments or times.

Key differentiator

FreezeGun stands out as an easy-to-use library specifically designed to mock the datetime module in Python, making it ideal for developers who need precise control over time-related tests without altering system-wide settings.

Capability profile

Capability Radar

Ease of StartEcosystemValueMaturityFlexibilityScale Ready

Honest assessment

Strengths & Weaknesses

↑ Strengths

Freeze time to a specific point for testing purposes.medium

Supports mocking of datetime, date, and time classes.medium

Easy integration with popular Python testing frameworks.medium

↓ Weaknesses

Limited to Python environmentshigh

Freezegun is specifically designed for Python and does not support other programming languages, which limits its utility in polyglot development teams.

Potential for unexpected behavior with complex datetime manipulationsmedium

When mocking datetime in complex applications with intricate time-based logic, Freezegun might not cover all edge cases leading to inconsistent test results.

Does not automatically mock third-party libraries using datetimehigh

If an application relies on external libraries that also use the datetime module, these must be manually mocked or configured to work with Freezegun, adding complexity.

Performance overhead during test executionlow

Mocking the datetime module can introduce additional overhead in tests, particularly when used extensively across a large suite of tests.

Fit analysis

Who is it for?

✓ Best for

Python developers who need to test time-sensitive code without changing system-wide settings.

Teams working on projects where consistent date and time behavior is crucial across different environments.

✕ Not a fit for

Projects that do not require mocking of the datetime module for testing purposes.

Developers looking for a solution beyond Python's ecosystem.

Cost structure

Pricing

Free Tier

Available

Open source — free to use

Starts at

$0

Model

Flat rate

Enterprise

None

Performance benchmarks

How Fast Is It?

Ecosystem

Relationships

Alternatives

Works well with

Next step

Get Started with freezegun

Step-by-step setup guide with code examples and common gotchas.

View Setup Guide →