From d6e22afd363a4c97c6ce3ba51971ad39640a95be Mon Sep 17 00:00:00 2001 From: Jan Pieter Waagmeester Date: Tue, 23 Jul 2024 07:40:20 +0200 Subject: [PATCH] Bump actions/setup-python from 5.1.0 to 5.1.1 (#126) Add shim for changed validation error message: https://github.com/django/django/commit/31837dbcb36f1ab57fb1b16cb0b126c55a1bdf01 --- .github/workflows/ci.yml | 10 +++++----- tests/test_translating.py | 11 +++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7e03b8..4d19085 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,7 @@ jobs: black: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v5.1.0 + - uses: actions/setup-python@v5.1.1 with: python-version: "3.11" - uses: actions/checkout@v4 @@ -14,7 +14,7 @@ jobs: flake8: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v5.1.0 + - uses: actions/setup-python@v5.1.1 with: python-version: "3.11" - uses: actions/checkout@v4 @@ -24,7 +24,7 @@ jobs: isort: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v5.1.0 + - uses: actions/setup-python@v5.1.1 with: python-version: "3.11" - uses: actions/checkout@v4 @@ -34,7 +34,7 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@v5.1.0 + - uses: actions/setup-python@v5.1.1 - uses: actions/checkout@v4 - run: python -m pip install -r docs/requirements.txt - run: cd docs/ && make html && make spelling @@ -88,7 +88,7 @@ jobs: - 5432:5432 steps: - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5.1.0 + uses: actions/setup-python@v5.1.1 with: python-version: ${{ matrix.python-version }} - uses: actions/checkout@v4 diff --git a/tests/test_translating.py b/tests/test_translating.py index f3281b7..90f30a9 100644 --- a/tests/test_translating.py +++ b/tests/test_translating.py @@ -1,3 +1,4 @@ +import django from django.core.exceptions import ImproperlyConfigured, ValidationError from django.db import models from django.test import TestCase @@ -289,9 +290,11 @@ def test_limit_choices_to(self): comment = app_models.Comment.objects.create(post=published_post, text="foo") self.assertIsNotNone(comment.pk) - with self.assertRaisesMessage( - ValidationError, - f"post instance with id {unpublished_post.pk} does not exist", - ): + if django.get_version().startswith("5.2"): + expected = f"post instance with id {unpublished_post.pk} is not a valid choice." + else: + expected = f"post instance with id {unpublished_post.pk} does not exist" + + with self.assertRaisesMessage(ValidationError, expected): comment.post = unpublished_post comment.full_clean()