Skip to content

Commit

Permalink
move landing page to markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
wimglenn committed Dec 12, 2024
1 parent b24a9ec commit c053d1e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 71 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: tests

on:
push:
branches:
- main
branches: [main]
pull_request:
branches:
- main
branches: [main]
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
Expand Down Expand Up @@ -40,7 +38,7 @@ jobs:
- name: Run tests for ${{ matrix.python-version }} on ${{ matrix.os }}
run: coverage run --source=pytest_freezer -m pytest && coverage report -m
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[![actions](https://github.com/pytest-dev/pytest-freezer/actions/workflows/tests.yml/badge.svg)](https://github.com/pytest-dev/pytest-freezer/actions/workflows/tests.yml/)
[![codecov](https://codecov.io/gh/pytest-dev/pytest-freezer/branch/main/graph/badge.svg)](https://codecov.io/gh/pytest-dev/pytest-freezer)
[![pypi](https://img.shields.io/pypi/v/pytest-freezer.svg)](https://pypi.org/project/pytest-freezer)
![womm](https://cdn.rawgit.com/nikku/works-on-my-machine/v0.2.0/badge.svg)

# pytest-freezer

[Pytest][1] plugin providing a fixture interface for [freezegun][2].

## Installation:

``` bash
$ 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][3] for the methods.

Time is frozen by default when the fixture is injected:

``` python
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:

``` python
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][4] plugin.

[1]: https://docs.pytest.org/
[2]: https://github.com/spulec/freezegun
[3]: https://github.com/spulec/freezegun#usage
[4]: https://github.com/ktosiek/pytest-freezegun
63 changes: 0 additions & 63 deletions README.rst

This file was deleted.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ build-backend = "flit_core.buildapi"

[project]
name = "pytest_freezer"
authors = [{name = "Wim Glenn", email = "[email protected]"}]
authors = [{name = "Wim Jeantine-Glenn", email = "[email protected]"}]
license = {file = "LICENSE"}
classifiers = [
"License :: OSI Approved :: MIT License",
"Framework :: Pytest",
]
version = "0.4.8"
version = "0.4.9"
dependencies = ["pytest >= 3.6", "freezegun >= 1.1"]
requires-python = ">= 3.6"
readme = "README.rst"
readme = "README.md"
description = "Pytest plugin providing a fixture interface for spulec/freezegun"

[project.urls]
Expand Down

0 comments on commit c053d1e

Please sign in to comment.