Skip to content

Commit aa09daf

Browse files
Migrate to pytest + migrate to pyproject.toml
1 parent 7abeb92 commit aa09daf

File tree

13 files changed

+101
-54
lines changed

13 files changed

+101
-54
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v2
12-
11+
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
1314
- name: Set up Python
14-
uses: actions/setup-python@v2
15+
uses: actions/setup-python@v5
1516
with:
16-
python-version: '3.9'
17-
architecture: 'x64'
17+
python-version: "3.x"
1818

1919
- name: Install dependencies
2020
run: |
2121
python -m pip install --upgrade pip
22-
pip install setuptools wheel twine
22+
pip install build twine
2323
2424
- name: Build source and binary distribution package
2525
run: |
26-
python setup.py sdist bdist_wheel
26+
python -m build
2727
env:
2828
PACKAGE_VERSION: ${{ github.ref }}
2929

.github/workflows/test.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
django-version: '5.1'
2525

2626
steps:
27-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
2828

2929
- name: Set up Python ${{ matrix.python-version }}
3030
uses: actions/setup-python@v2
@@ -34,23 +34,16 @@ jobs:
3434
- name: Install dependencies and package
3535
run: |
3636
python -m pip install --upgrade pip
37-
pip install -r requirements.txt
37+
pip install -e ".[dev]"
3838
pip install django~=${{ matrix.django-version }}.0
3939
4040
- name: Run lint and code review
4141
run: |
4242
pre-commit run --all-files
4343
- name: Run tests with coverage
4444
run: |
45-
# prepare Django project: link all necessary data from the test project into the root directory
46-
# Hint: Simply changing the directory does not work (leads to missing files in coverage report)
47-
ln -s ./tests/core core
48-
ln -s ./tests/testapp testapp
49-
ln -s ./tests/manage.py manage.py
5045
# run tests with coverage
51-
coverage run \
52-
--source='./django_future_tasks' \
53-
manage.py test
46+
pytest --cov=django_future_tasks tests
5447
coverage xml
5548
- name: Upload coverage to Codecov
5649
uses: codecov/codecov-action@v3

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ __pycache__
44
db.sqlite3
55
build/*
66
tests/static/*
7+
.python-version
8+
.coverage
9+
uv.lock

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ repos:
2020
- id: add-trailing-comma
2121

2222
- repo: https://github.com/astral-sh/ruff-pre-commit
23-
rev: v0.6.9
23+
rev: v0.12.8
2424
hooks:
25-
- id: ruff
25+
- id: ruff-check
2626
args: [ --fix ]
2727
- id: ruff-format

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.2]
9+
10+
### Changed
11+
12+
- Migrate to `pytest`.
13+
- Migrate to `pyproject.toml`.
14+
15+
## [1.3.1]
16+
17+
### Fixed
18+
19+
- Fix infinite loop in populate_periodic_future_tasks on IntegrityError
20+
821
## [1.3.0]
922

1023
### Added

pyproject.toml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[project]
2+
name = "django-future-tasks"
3+
description = "A library to create periodic, cron-like tasks or single tasks with a specified execution/start time and schedule it to run in the future."
4+
readme = "README.md"
5+
requires-python = ">=3.9"
6+
license = {text = "MIT"}
7+
authors = [
8+
{name = "Armin Ster", email = "aster@anexia-it.com"},
9+
]
10+
classifiers = [
11+
"Development Status :: 5 - Production/Stable",
12+
"Framework :: Django",
13+
"Framework :: Django :: 4.2",
14+
"Framework :: Django :: 5.0",
15+
"Framework :: Django :: 5.1",
16+
"Intended Audience :: Developers",
17+
"Operating System :: OS Independent",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.9",
21+
"Programming Language :: Python :: 3.10",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
25+
]
26+
dynamic = ["version"]
27+
dependencies = [
28+
"croniter>=3.0.3,<3.1",
29+
"django-cronfield>=0.2.0,<0.3",
30+
]
31+
32+
[project.optional-dependencies]
33+
dev = [
34+
"django>=4.2,<5.2",
35+
"pre-commit>=4.3,<4.4",
36+
"pytest>=8.4,<8.5",
37+
"pytest-cov>=7.0,<7.1",
38+
"pytest-django>=4.11,<4.12",
39+
"time-machine>=2.15.0,<2.17.0",
40+
]
41+
42+
[project.urls]
43+
Homepage = "https://github.com/anexia/django-future-tasks"
44+
Documentation = "https://github.com/anexia/django-future-tasks/blob/main/README.md"
45+
Repository = "https://github.com/anexia/django-future-tasks"
46+
Issues = "https://github.com/anexia/django-future-tasks/issues"
47+
Changelog = "https://github.com/anexia/django-future-tasks/blob/main/CHANGELOG.md"
48+
49+
[tool.pytest.ini_options]
50+
DJANGO_SETTINGS_MODULE = "core.settings"
51+
52+
[build-system]
53+
requires = ["setuptools"]
54+
build-backend = "setuptools.build_meta"

requirements.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name="django-future-tasks",
13-
version=os.getenv("PACKAGE_VERSION", "1.3.0").replace("refs/tags/", ""),
13+
version=os.getenv("PACKAGE_VERSION", "1.3.2").replace("refs/tags/", ""),
1414
packages=find_packages(),
1515
include_package_data=True,
1616
install_requires=[

tests/testapp/apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ class TestappConfig(AppConfig):
55
name = "testapp"
66

77
# import signal handlers
8-
import tests.testapp.handlers
8+
import testapp.handlers

tests/testapp/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from django.dispatch import receiver
66

77
from django_future_tasks.handlers import future_task_signal
8-
from tests.core import settings
8+
from core import settings
99

1010

1111
@receiver(future_task_signal, sender=intern(settings.FUTURE_TASK_TYPE_ONE))

0 commit comments

Comments
 (0)