Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
libfaketime-tz-wrapper
Advanced tools
A wrapper around python-libfaketime that introduces timezone-awareness.
A wrapper around python-libfaketime <https://github.com/simon-weber/python-libfaketime>
__
that introduces awareness for (django) timezones.
Install with pip:
.. code-block:: sh
$ 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:
.. 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.
.. 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
A wrapper around python-libfaketime that introduces timezone-awareness.
We found that libfaketime-tz-wrapper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.