mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-25 20:18:12 +08:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f4775c689 | ||
|
|
fde502d8a0 | ||
|
|
8184bf579c | ||
|
|
50b3da87d4 | ||
|
|
7027a9dd7e | ||
|
|
9e32b15d8a | ||
|
|
55bdeb4d33 | ||
|
|
73c35cb5c7 |
+26
-13
@@ -7,11 +7,6 @@ on:
|
||||
branches:
|
||||
- master
|
||||
|
||||
# for code coverage comment
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
env:
|
||||
MONGO_HOST: "127.0.0.1"
|
||||
REDIS_HOST: "127.0.0.1"
|
||||
@@ -88,6 +83,11 @@ jobs:
|
||||
env:
|
||||
SERVICES: sqs
|
||||
MINISTACK_HOST: aws
|
||||
# options: >-
|
||||
# --health-cmd "wget -qO- http://localhost:4566/_ministack/ready || exit 1"
|
||||
# --health-interval 2s
|
||||
# --health-retries 15
|
||||
# --health-timeout 5s
|
||||
ports:
|
||||
- 4566:4566
|
||||
steps:
|
||||
@@ -105,12 +105,25 @@ jobs:
|
||||
run: aws sqs create-queue --queue-name testing
|
||||
- name: Run Tests
|
||||
run: |
|
||||
uv run pytest --cov=./django_q --cov-report=xml --junitxml=pytest.xml --cov-report=term-missing:skip-covered | tee pytest-coverage.txt
|
||||
uv run pytest --cov=./django_q --cov-report=xml
|
||||
- name: Upload to coveralls
|
||||
run: |
|
||||
python -m pip install coveralls
|
||||
coveralls --service=github
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
COVERALLS_FLAG_NAME: python-${{ matrix.python-version }}-django-${{ matrix.django }}
|
||||
COVERALLS_PARALLEL: true
|
||||
|
||||
- name: Coverage comment
|
||||
if: matrix.python-version == '3.13' && matrix.django == '5.2' && github.event_name == 'pull_request'
|
||||
uses: MishaKav/pytest-coverage-comment@v1
|
||||
with:
|
||||
pytest-coverage-path: ./pytest-coverage.txt
|
||||
junitxml-path: ./pytest.xml
|
||||
report-only-changed-files: true
|
||||
finish:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
container: python:3.11-bookworm
|
||||
steps:
|
||||
- name: Upload to coveralls
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install coveralls
|
||||
coveralls --service=github --finish
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## [v1.11.1](https://github.com/django-q2/django-q2/tree/v1.11.1) (2026-08-26)
|
||||
|
||||
- Swap localstorage to ministack (#343) https://github.com/django-q2/django-q2/pull/343
|
||||
- Show test coverage in github pull request comment (#344) https://github.com/django-q2/django-q2/pull/344
|
||||
- Fix cluster requesting hardcoded unix-only fork context (#347) https://github.com/django-q2/django-q2/pull/347
|
||||
|
||||
## [v1.11.0](https://github.com/django-q2/django-q2/tree/v1.11.0) (2026-08-10)
|
||||
|
||||
- AttributeError when start_event is None, and guard process faster stop (#305) https://github.com/django-q2/django-q2/pull/305
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
VERSION = (1, 11, 1)
|
||||
VERSION = (1, 11, 0)
|
||||
|
||||
__all__ = ["conf", "cluster", "models", "tasks"]
|
||||
|
||||
+1
-4
@@ -41,10 +41,7 @@ from django_q.worker import worker
|
||||
|
||||
|
||||
def get_mp_context():
|
||||
if "fork" in multiprocessing.get_all_start_methods():
|
||||
return multiprocessing.get_context("fork")
|
||||
else:
|
||||
return multiprocessing.get_context()
|
||||
return multiprocessing.get_context("fork")
|
||||
|
||||
|
||||
class Cluster:
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import multiprocessing
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
@@ -14,7 +13,7 @@ import pytest
|
||||
from django.utils import timezone
|
||||
|
||||
from django_q.brokers import Broker, get_broker
|
||||
from django_q.cluster import Cluster, Sentinel, get_mp_context
|
||||
from django_q.cluster import Cluster, Sentinel
|
||||
from django_q.conf import Conf
|
||||
from django_q.humanhash import DEFAULT_WORDLIST, uuid
|
||||
from django_q.models import Success, Task
|
||||
@@ -60,53 +59,6 @@ def broker(monkeypatch):
|
||||
return get_broker()
|
||||
|
||||
|
||||
def test_get_mp_context_prefers_fork_when_available(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
multiprocessing,
|
||||
"get_all_start_methods",
|
||||
lambda: ["fork", "spawn", "forkserver"],
|
||||
)
|
||||
|
||||
calls = []
|
||||
|
||||
class DummyContext:
|
||||
def get_start_method(self):
|
||||
return "fork"
|
||||
|
||||
def fake_get_context(method=None):
|
||||
calls.append(method)
|
||||
return DummyContext()
|
||||
|
||||
monkeypatch.setattr(multiprocessing, "get_context", fake_get_context)
|
||||
|
||||
assert get_mp_context().get_start_method() == "fork"
|
||||
assert calls == ["fork"]
|
||||
|
||||
|
||||
def test_get_mp_context_falls_back_to_platform_default_without_fork(monkeypatch):
|
||||
"""
|
||||
Regression test: get_mp_context() used to hardcode the unix-only "fork"
|
||||
context, which raises ValueError on platforms (e.g. Windows) that don't
|
||||
support it. It should instead defer to the platform's default context
|
||||
whenever "fork" isn't available.
|
||||
"""
|
||||
monkeypatch.setattr(multiprocessing, "get_all_start_methods", lambda: ["spawn"])
|
||||
|
||||
calls = []
|
||||
real_get_context = multiprocessing.get_context
|
||||
|
||||
def fake_get_context(method=None):
|
||||
calls.append(method)
|
||||
return real_get_context(method)
|
||||
|
||||
monkeypatch.setattr(multiprocessing, "get_context", fake_get_context)
|
||||
|
||||
get_mp_context()
|
||||
|
||||
# Must ask for the platform default (no explicit method), should never be equal to "fork"
|
||||
assert calls == [None]
|
||||
|
||||
|
||||
def test_redis_connection(broker):
|
||||
assert broker.ping() is True
|
||||
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ author = "Ilan Steemers, Stan Triepels"
|
||||
# The short X.Y version.
|
||||
version = "1.11"
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = "1.11.1"
|
||||
release = "1.11.0"
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
||||
|
||||
[project]
|
||||
name = "django-q2"
|
||||
version = "1.11.1"
|
||||
version = "1.11.0"
|
||||
packages = [
|
||||
{ include = "django_q" },
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user