Skip to main content

A wrapper around python-libfaketime that introduces timezone-awareness.

Project description

A wrapper around python-libfaketime that introduces awareness for (django) timezones.


Install with pip:

$ pip install libfaketime-tz-wrapper


libfaketime needs the LD_PRELOAD variable to be set.

If you run your tests in PyCharm, add it to the environment variables of your test configuration in PyCharm:

value: /home/foo/<snip>/vendor/libfaketime/src/

If you run tests in the command line, export this environment variable when running the test command:

$ LD_PRELOAD=/home/foo/<snip>/vendor/libfaketime/src/ <run test command>

In both cases, replace the <snip> part with the correct path to where the libfaketime package was installed.


import datetime

from libfaketime import fake_time

def get_tomorrow():
    return + datetime.timedelta(days=1)

@fake_time('2014-01-01 00:00:00')
def test_get_tomorrow():
    assert get_tomorrow() ==, 1, 2)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for libfaketime-tz-wrapper, version 1.1.1
Filename, size File type Python version Upload date Hashes
Filename, size libfaketime-tz-wrapper-1.1.1.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page