Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 1.58 KB

README.rst

File metadata and controls

50 lines (33 loc) · 1.58 KB

time-machine

https://img.shields.io/readthedocs/time-machine?style=for-the-badge https://img.shields.io/github/actions/workflow/status/adamchainz/time-machine/main.yml.svg?branch=main&style=for-the-badge https://img.shields.io/badge/Coverage-100%25-success?style=for-the-badge https://img.shields.io/pypi/v/time-machine.svg?style=for-the-badge https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge pre-commit
time-machine logo

Travel through time in your tests.

A quick example:

import datetime as dt
from zoneinfo import ZoneInfo
import time_machine

hill_valley_tz = ZoneInfo("America/Los_Angeles")


@time_machine.travel(dt.datetime(1985, 10, 26, 1, 24, tzinfo=hill_valley_tz))
def test_delorean():
    assert dt.date.today().isoformat() == "1985-10-26"

Documentation

Please see https://time-machine.readthedocs.io/.