# spulec/freezegun

Let your Python tests travel through time

Repository: https://github.com/spulec/freezegun
Canonical: https://ross.abutalabs.com/products/freezegun
Language: Python
License: Apache-2.0
License Family: permissive
Last push: 2025-08-19T19:29:42+00:00

## Health v2 (maintenance only)
Score: 51/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 37, release rhythm 42, longevity 100
- inputs: {"age_days": 5013, "days_push": 379, "days_rel": 389, "gap_med": 17, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4525, forks 301 (observed 2026-08-28T04:08:52.876386+00:00)

## What it is
FreezeGun is a Python library that lets tests 'travel through time' by mocking datetime and time module functions. It provides a decorator and context manager to freeze the clock at a fixed moment during test execution.

## Use cases
- test code that depends on the current date or time
- freeze datetime.now() in pytest tests
- mock time.time() for deterministic unit tests
- simulate deadlines and expiry logic in tests
- test time-based scheduling behavior deterministically

## When to choose
- your Python tests need deterministic control over datetime or time functions
- you use pytest or unittest and want a decorator/context-manager API
- you need to test expiry, scheduling, or date-dependent logic

## When to avoid
- you need to mock time in non-Python languages
- you need full control over monotonic clock semantics beyond what freezegun guarantees
- your code uses time sources freezegun does not patch

## Facets
- artifact type: library
- maturity: stable
- function: testing, mocking, date-time
- domain: testing, developer-tools
- platform: python, cross-platform
- tags: time-mocking, pytest, unittest, datetime

## Member repositories
- spulec/freezegun (main) score 51

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:52.876386+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:20:15.510021+00:00, confidence not recorded.
  - readme: https://github.com/spulec/freezegun (fetched 2026-08-28T04:08:52.876386+00:00, sha 59e5e3bc5741)
  - registry_pypi: https://pypi.org/pypi/freezegun/json (fetched 2026-08-29T09:06:00.631562+00:00, sha 6ec14ea1419a)
- Data as of 2026-08-30T08:39:29.467469+00:00.
