pytest-freezeblaster
Wrap tests with fixtures in freeze_time
Features
- Freeze time in both the test and fixtures
- Access the freezer when you need it
Installation
You can install "pytest-freezeblaster" via pip from PyPI:
$ pip install pytest-freezeblaster
Usage
Freeze time by using the freezer fixture:
def test_frozen_date(freezer):
now = datetime.now()
time.sleep(1)
later = datetime.now()
assert now == later
This can then be used to move time:
def test_moving_date(freezer):
now = datetime.now()
freezer.move_to('2017-05-20')
later = datetime.now()
assert now != later
You can also pass arguments to freezegun by using the freeze_time mark:
@pytest.mark.freeze_time('2017-05-21')
def test_current_date():
assert date.today() == date(2017, 5, 21)
The freezer fixture and freeze_time mark can be used together,
and they work with other fixtures:
@pytest.fixture
def current_date():
return date.today()
@pytest.mark.freeze_time
def test_changing_date(current_date, freezer):
freezer.move_to('2017-05-20')
assert current_date == date(2017, 5, 20)
freezer.move_to('2017-05-21')
assert current_date == date(2017, 5, 21)
They can also be used in class-based tests:
class TestDate:
@pytest.mark.freeze_time
def test_changing_date(self, current_date, freezer):
freezer.move_to('2017-05-20')
assert current_date == date(2017, 5, 20)
freezer.move_to('2017-05-21')
assert current_date == date(2017, 5, 21)
Credits
All credits go to ktosiek.
Metadata
Release files for pytest-freezeblaster 2.1.0
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 | |
|---|---|---|---|---|
| pytest_freezeblaster-2.1.0.tar.gz | 2.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_freezeblaster-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.2 kB
Release files / pytest_freezeblaster-2.1.0.tar.gz
| Download URL | pytest_freezeblaster-2.1.0.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b65151cba75296e4fa06d8298640fde64a1ff0f885bda81f2cf204d1fbd0d853
|
|
BLAKE2b-256 checksum How to use checksums |
ed15e2c64d0007f87b50d71166bd501b423aad6cc696a58ff67f449b5dc1ca90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2025.
Transparency logRelease files / pytest_freezeblaster-2.1.0-py3-none-any.whl
| Download URL | pytest_freezeblaster-2.1.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ee83db7a4565ae1f4c7fa688281b3f50b1d1b860e90610dddb2b16db5964405c
|
|
BLAKE2b-256 checksum How to use checksums |
7a7b715d468e273d69bc25820588a62181df4db55d435b99fb5591087425a453
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2025.
Transparency logSecurity for pytest-freezeblaster 2.1.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pytest_freezeblaster-2.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2025.
Transparency logA 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.