Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

libfaketime-tz-wrapper

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libfaketime-tz-wrapper

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

  • 1.1.1
  • PyPI
  • Socket score

Maintainers
1

A wrapper for libfaketime, introducing timezone-awareness.

A wrapper around python-libfaketime <https://github.com/simon-weber/python-libfaketime>__ that introduces awareness for (django) timezones.

Installation

Install with pip:

.. code-block:: sh

$ pip install libfaketime-tz-wrapper

Setup

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:

.. code-block::

name: LD_PRELOAD
value: /home/foo/<snip>/vendor/libfaketime/src/libfaketime.so.1

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

.. code-block:: sh

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

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

Usage

.. code-block:: python

import datetime

from libfaketime import fake_time

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


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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc