pytest-freezer
Pytest plugin providing a fixture interface for freezegun.
Installation:
$ python -m pip install pytest-freezer
Usage:
The fixture name is freezer. It is a freezegun.api.FrozenDateTimeFactory instance,
so refer to upstream freezegun usage for the methods.
Time is frozen by default when the fixture is injected:
def test_frozen_date(freezer):
now = datetime.now()
time.sleep(1)
later = datetime.now()
assert now == later
Time can be controlled within a test by using methods on the fixture:
def test_freezer_methods(freezer):
freezer.move_to("2022-10-17")
assert datetime.now() == datetime(2022, 10, 17)
freezer.tick()
assert datetime.now() == datetime(2022, 10, 17, 0, 0, 1)
freezer.tick(delta=12)
assert datetime.now() == datetime(2022, 10, 17, 0, 0, 13)
Acknowledgements:
Credit to Tomasz Kontusz for the original pytest-freezegun plugin.
Metadata
Release files for pytest-freezer 0.4.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_freezer-0.4.9.tar.gz | 3.2 kB | Without provenance | Details for pytest_freezer-0.4.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_freezer-0.4.9-py3-none-any.whl | Python 3 | none | any | Details for pytest_freezer-0.4.9-py3-none-any.whl |
Total release size: 6.4 kB
Release files / pytest_freezer-0.4.9.tar.gz
| Download URL | pytest_freezer-0.4.9.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21bf16bc9cc46bf98f94382c4b5c3c389be7056ff0be33029111ae11b3f1c82a
|
|
BLAKE2b-256 checksum How to use checksums |
81f098dcbc5324064360b19850b14c84cea9ca50785d921741dbfc442346e925
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.7
|
Release files / pytest_freezer-0.4.9-py3-none-any.whl
| Download URL | pytest_freezer-0.4.9-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b6c50523b7d4aec4590b52bfa5ff766d772ce506e2bf4846c88041ea9ccae59
|
|
BLAKE2b-256 checksum How to use checksums |
c1e930252bc05bcf67200a17f4f0b4cc7598f0a68df4fa9fa356193aa899f145
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.7
|
Security for pytest-freezer 0.4.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.