Skip to content

Commit

Permalink
dep-update, add pydantic 2.7, acme 2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Apr 21, 2024
1 parent 948bca5 commit 4ccd679
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/faketime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5.0.0
with:
python-version: 3.12
python-version: "3.12"
architecture: x64

- name: Apply caching of dependencies
Expand All @@ -35,4 +35,4 @@ jobs:
pip install -r requirements.txt -r requirements/requirements-test.txt
- name: Run tests
run: faketime -f +100y pytest -v --cov-report term-missing --durations=20
run: faketime -f +100y pytest -v --no-selenium --cov-report term-missing --durations=20
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
django-version: [ "4.2.0", "5.0.0", ]
cryptography-version: [ "42.0" ]
pydantic-version: [ "2.5.0", "2.6.0" ]
pydantic-version: [ "2.5.0", "2.6.0", "2.7.0" ]
exclude:
- python-version: 3.9
django-version: 5.0.0
Expand Down
16 changes: 2 additions & 14 deletions ca/django_ca/tests/base/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from django_ca.models import Certificate, CertificateAuthority, DjangoCAModel, X509CertMixin
from django_ca.signals import post_revoke_cert, post_sign_cert, pre_sign_cert
from django_ca.tests.admin.assertions import assert_change_response, assert_changelist_response
from django_ca.tests.base.constants import CERT_DATA, TIMESTAMPS
from django_ca.tests.base.constants import CERT_DATA
from django_ca.tests.base.mocks import mock_signal
from django_ca.tests.base.typehints import DjangoCAModelTypeVar

Expand Down Expand Up @@ -408,16 +408,13 @@ def expires(cls, days: int) -> timedelta:

@contextmanager
def freeze_time(
self, timestamp: Union[str, datetime]
self, timestamp: Union[datetime]
) -> Iterator[Union[FrozenDateTimeFactory, StepTickTimeFactory]]:
"""Context manager to freeze time to a given timestamp.
If `timestamp` is a str that is in the `TIMESTAMPS` dict (e.g. "everything-valid"), use that
timestamp.
"""
if isinstance(timestamp, str): # pragma: no branch
timestamp = TIMESTAMPS[timestamp]

with freeze_time(timestamp) as frozen:
yield frozen

Expand Down Expand Up @@ -595,15 +592,6 @@ def create_superuser(
"""Shortcut to create a superuser."""
return User.objects.create_superuser(username=username, password=password, email=email)

@contextmanager
def freeze_time(
self, timestamp: Union[str, datetime]
) -> Iterator[Union[FrozenDateTimeFactory, StepTickTimeFactory]]:
"""Overridden to force a client login, otherwise the user session is expired."""
with super().freeze_time(timestamp) as frozen:
self.client.force_login(self.user)
yield frozen

def get_changelist_view(self, data: Optional[dict[str, str]] = None) -> "HttpResponse":
"""Get the response to a changelist view for the given model."""
return self.client.get(self.changelist_url, data)
Expand Down
7 changes: 7 additions & 0 deletions ca/django_ca/tests/key_backends/test_storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ def test_check_usable_no_path_configured(root: CertificateAuthority) -> None:
root.check_usable(UsePrivateKeyOptions(password=None))


def test_is_usable_no_path_configured(root: CertificateAuthority) -> None:
"""Test is_usable() when no path is configured."""
root.key_backend_options = {}
root.save()
assert root.is_usable(UsePrivateKeyOptions(password=None)) is False


def test_get_ocsp_key_size_with_invalid_key_type(usable_ec: CertificateAuthority) -> None:
"""Test getting key size for a non-RSA/DSA CA."""
with pytest.raises(ValueError, match=r"^This function should only be called with RSA/DSA CAs\.$"):
Expand Down
5 changes: 3 additions & 2 deletions devscripts/validation/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ def check_github_action_versions(job: dict[str, Any]) -> int:

if action == "actions/setup-python":
py_version = step_config["with"]["python-version"]
if py_version not in ("${{ matrix.python-version }}", config.PYTHON_RELEASES[-1]):
errors += err(f"Outdated Python version: {py_version}")
newest_python = config.PYTHON_RELEASES[-1]
if py_version not in ("${{ matrix.python-version }}", newest_python):
errors += err(f"Outdated Python version: {py_version} (newest: {newest_python})")
return errors


Expand Down
1 change: 1 addition & 0 deletions docs/source/changelog/TBR_1.29.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Profiles
Dependencies
************

* Add support for ``acme~=2.10.0`` and ``pydantic~=2.7.0``.
* **BACKWARDS INCOMPATIBLE:** Dropped support for Python 3.8.
* **BACKWARDS INCOMPATIBLE:** Dropped support for ``cryptography~=41.0``, ``acme~=2.7.0`` and ``acme~=2.8.0``.

Expand Down
8 changes: 4 additions & 4 deletions docs/source/quickstart/as_app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ tested with what release (changes to previous versions in **bold**):

.. Keep no more then 10 releases in this table.
=========== ============== ================== =============== ============= =================== =========
=========== ============== ================== =============== ============= =================== =============
django-ca Python Django cryptography Celery acme pydantic
=========== ============== ================== =============== ============= =================== =========
1.29 **3.9** - 3.12 4.2 - 5.0 **42** 5.3 **2.9** 2.5 - 2.6
=========== ============== ================== =============== ============= =================== =============
1.29 **3.9** - 3.12 4.2 - 5.0 **42** 5.3 - **5.4** **2.9** - **2.10** 2.5 - **2.7**
1.28 3.8 - 3.12 **4.2** - **5.0** 41 - **42** 5.3 **2.7** - **2.9** 2.5 - 2.6
1.27 3.8 - **3.12** 3.2, **4.2** **41** **5.3** 2.6 - **2.7**
1.26 3.8 - 3.11 3.2, 4.1 - 4.2 **40** - 41 **5.2** - 5.3 **2.5** - 2.6
Expand All @@ -42,7 +42,7 @@ django-ca Python Django cryptography Celery acme
1.22 3.7 - **3.11** 3.2 - **4.1** **36** - **38** **5.1** - 5.2 **1.27** - **2.1**
1.21 3.7 - 3.10 **3.2** - 4.0 **35** - **37** 5.0 - 5.2 **1.23** - **1.25**
1.20 **3.7 - 3.10** **2.2, 3.2 - 4.0** **3.4 - 36** 5.0 - **5.2** **1.22**
=========== ============== ================== =============== ============= =================== =========
=========== ============== ================== =============== ============= =================== =============

Note that we don't deliberately break support for older versions, we merely stop testing it. You can try your
luck with older versions.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ python = ["3.9", "3.10", "3.11", "3.12"]
# https://www.djangoproject.com/download/
django = ["4.2", "5.0"]
cryptography = ["42"]
acme = ["2.9"]
pydantic = ["2.5", "2.6"]
acme = ["2.9", "2.10"]
pydantic = ["2.5", "2.6", "2.7"]

# https://alpinelinux.org/releases/
alpine = [
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
pre-commit==3.7.0
pylint-django==2.5.5
pylint==3.1.0
ruff==0.3.7
ruff==0.4.1
setuptools>=65
8 changes: 4 additions & 4 deletions requirements/requirements-mypy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ types-docutils==0.20.0.20240406
types-freezegun==1.1.10
types-jinja2==2.11.9
types-mysqlclient==2.2.0.20240311
types-psycopg2==2.9.21.20240311
types-pyOpenSSL==24.0.0.20240311
types-psycopg2==2.9.21.20240417
types-pyOpenSSL==24.0.0.20240417
types-pyRFC3339==1.1.1.5
types-redis==4.6.0.20240409
types-redis==4.6.0.20240417
types-requests==2.31.0.20240406
types-setuptools==69.2.0.20240317
types-setuptools==69.5.0.20240415
types-tabulate==0.9.0.20240106
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
envlist = pylint,docs,lint,mypy,demo,dist-test
py{310,311,312}-dj{5.0}-cg{42}-acme{2.9}-pydantic{2.5,2.6}
py{39,310,311,312}-dj{4.2}-cg{42}-acme{2.9}-pydantic{2.5,2.6}
py{310,311,312}-dj{5.0}-cg{42}-acme{2.9,2.10}-pydantic{2.5,2.6,2.7}
py{39,310,311,312}-dj{4.2}-cg{42}-acme{2.9,2.10}-pydantic{2.5,2.6,2.7}
faketime

[testenv]
Expand All @@ -13,8 +13,10 @@ deps =
dj5.0: Django~=5.0.0
cg42: cryptography~=42.0
acme2.9: acme~=2.9.0
acme2.10: acme~=2.10.0
pydantic2.5: pydantic~=2.5.0
pydantic2.6: pydantic~=2.6.0
pydantic2.7: pydantic~=2.7.0
setenv =
COVERAGE_FILE = {envdir}/.coverage
commands =
Expand All @@ -29,7 +31,7 @@ setenv =
COVERAGE_FILE = {envdir}/.coverage
allowlist_externals = faketime
commands =
faketime -f "+100y" pytest -v --basetemp="{env_tmp_dir}" --cov-report html:{envdir}/htmlcov/ --durations=20 {posargs}
faketime -f "+100y" pytest -v --no-selenium --basetemp="{env_tmp_dir}" --cov-report html:{envdir}/htmlcov/ --durations=20 {posargs}

[testenv:demo]
basepython = python3
Expand Down

0 comments on commit 4ccd679

Please sign in to comment.