Skip to main content

Wrap tests with fixtures in freeze_time

Project description


.. image::
:alt: See Build Status on Travis CI

.. image::
:alt: See Build Status on AppVeyor

Wrap tests with fixtures in freeze_time


* Freeze time in both the test and fixtures
* Access the freezer when you need it


You can install "pytest-freezegun" via `pip`_ from `PyPI`_::

$ pip install pytest-freezegun


All the features can be seen in this example:

.. code-block:: python

def current_date():

def test_current_date(current_date):
assert current_date == date(2017, 5, 21)

def test_changing_date(current_date, freezer):
assert current_date == date(2017, 5, 20)
assert current_date == date(2017, 5, 21)

def test_not_using_marker(freezer):
now =
later =
assert now == later

Contributions are very welcome.
Tests can be run with `tox`_.
You can later check coverage with `coverage combine && coverage html`.
Please try to keep coverage at least the same before you submit a pull request.


Distributed under the terms of the `MIT`_ license, "pytest-freezegun" is free and open source software


If you encounter any problems, please `file an issue`_ along with a detailed description.


This `Pytest`_ plugin was generated with `Cookiecutter`_ along with `@hackebrot`_'s `Cookiecutter-pytest-plugin`_ template.

.. _`Cookiecutter`:
.. _`@hackebrot`:
.. _`MIT`:
.. _`cookiecutter-pytest-plugin`:
.. _`file an issue`:
.. _`pytest`:
.. _`tox`:
.. _`pip`:
.. _`PyPI`:

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 pytest-freezegun, version 0.3.0.post1
Filename, size File type Python version Upload date Hashes
Filename, size pytest_freezegun-0.3.0.post1-py2.py3-none-any.whl (4.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size (8.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page