From f7c431bc0cd45189209513a39f2f19c433801ef3 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 23 Mar 2024 08:56:12 +0100 Subject: [PATCH 1/3] GitHub Actions: Run tests_with_pytz_installed --- .github/workflows/main.yml | 1 + docs/api-guide/caching.md | 6 ++---- requirements/requirements-testing.txt | 1 + tests/test_fields.py | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c3c587cbf1..474339f408 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,6 +12,7 @@ jobs: runs-on: ubuntu-20.04 strategy: + fail-fast: false matrix: python-version: - '3.6' diff --git a/docs/api-guide/caching.md b/docs/api-guide/caching.md index d5f7ecb3a1..c4ab215c84 100644 --- a/docs/api-guide/caching.md +++ b/docs/api-guide/caching.md @@ -75,11 +75,9 @@ from rest_framework.response import Response @cache_page(60 * 15) @vary_on_cookie -@api_view(['GET']) +@api_view(["GET"]) def get_user_list(request): - content = { - 'user_feed': request.user.get_user_feed() - } + content = {"user_feed": request.user.get_user_feed()} return Response(content) ``` diff --git a/requirements/requirements-testing.txt b/requirements/requirements-testing.txt index 2b39316a00..74388e2819 100644 --- a/requirements/requirements-testing.txt +++ b/requirements/requirements-testing.txt @@ -2,6 +2,7 @@ pytest>=7.0.1,<8.0 pytest-cov>=4.0.0,<5.0 pytest-django>=4.5.2,<5.0 +pytz importlib-metadata<5.0 # temporary pin of attrs attrs==22.1.0 diff --git a/tests/test_fields.py b/tests/test_fields.py index 2b6fc56ac0..16c3ebc60f 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -9,6 +9,7 @@ from unittest.mock import patch import pytest +from django import VERSION as DJANGO_VERSION try: import pytz @@ -672,6 +673,7 @@ def test_valid_inputs(self, *args): assert self.field.run_validation(input_value) == expected_output, \ 'input value: {}'.format(repr(input_value)) + @pytest.mark.xfail(pytz and DJANGO_VERSION >= (5, 0), reason="Django v5 drops support for pytz") def test_invalid_inputs(self, *args): """ Ensure that invalid values raise the expected validation error. From 85102f62df6bb8d6016ddff94752cf0a1e8a3104 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 24 Mar 2024 16:16:51 +0100 Subject: [PATCH 2/3] Revert the import of pytz --- requirements/requirements-testing.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements/requirements-testing.txt b/requirements/requirements-testing.txt index 74388e2819..2b39316a00 100644 --- a/requirements/requirements-testing.txt +++ b/requirements/requirements-testing.txt @@ -2,7 +2,6 @@ pytest>=7.0.1,<8.0 pytest-cov>=4.0.0,<5.0 pytest-django>=4.5.2,<5.0 -pytz importlib-metadata<5.0 # temporary pin of attrs attrs==22.1.0 From 6f250d3de7c775ed22dfab043bb00b4b3c38ecf5 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 28 Mar 2024 22:18:49 +0100 Subject: [PATCH 3/3] Update .github/workflows/main.yml Co-authored-by: Tom Christie --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 474339f408..c3c587cbf1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,6 @@ jobs: runs-on: ubuntu-20.04 strategy: - fail-fast: false matrix: python-version: - '3.6'