From 1b2d89c1c90ef058641cdd654f73f0db9d8b47d2 Mon Sep 17 00:00:00 2001 From: Sergey Klyuykov Date: Sat, 11 Feb 2023 22:56:19 +0400 Subject: [PATCH] Fix: Tests for Python 3.11. --- .github/workflows/review.yml | 2 +- README.rst | 8 ++++---- requirements/test.txt | 2 +- tox.ini | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml index 0f08bede..82cedaed 100644 --- a/.github/workflows/review.yml +++ b/.github/workflows/review.yml @@ -8,7 +8,7 @@ jobs: runs-on: "ubuntu-20.04" strategy: matrix: - python: ["3.7", "3.8", "3.9", "3.10"] + python: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - name: Checkout the source code diff --git a/README.rst b/README.rst index 19b3e26e..226c8b98 100644 --- a/README.rst +++ b/README.rst @@ -13,7 +13,7 @@ Compatible with - **Django Rest Framework**: 3.10, 3.11, 3.12, 3.13, 3.14 - **Django**: 2.2, 3.0, 3.1, 3.2, 4.0, 4.1 -- **Python**: 3.6, 3.7, 3.8, 3.9, 3.10 +- **Python**: 3.6, 3.7, 3.8, 3.9, 3.10, 3.11 Only the latest patch version of each ``major.minor`` series of Python, Django and Django REST Framework is supported. @@ -362,7 +362,7 @@ provided out of the box - if you have ``djangorestframework-recursive`` installe drf-extra-fields ================= -Integration with `drf-extra-fields `_ has a problem with Base64 fields. +Integration with `drf-extra-fields `_ has a problem with Base64 fields. The drf-yasg will generate Base64 file or image fields as Readonly and not required. Here is a workaround code for display the Base64 fields correctly. @@ -370,7 +370,7 @@ for display the Base64 fields correctly. class PDFBase64FileField(Base64FileField): ALLOWED_TYPES = ['pdf'] - + class Meta: swagger_schema_fields = { 'type': 'string', @@ -378,7 +378,7 @@ for display the Base64 fields correctly. 'description': 'Content of the file base64 encoded', 'read_only': False # <-- FIX } - + def get_file_extension(self, filename, decoded_file): try: PyPDF2.PdfFileReader(io.BytesIO(decoded_file)) diff --git a/requirements/test.txt b/requirements/test.txt index d3a119c7..57f94041 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -5,7 +5,7 @@ pytest-cov>=2.6.0 pytest-xdist>=1.25.0 pytest-django>=3.4.4 datadiff==2.0.0 -psycopg2-binary==2.9.4 +psycopg2-binary==2.9.5 django-fake-model==0.1.4 -r testproj.txt diff --git a/tox.ini b/tox.ini index 13adf8f9..d06cf102 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ envlist = py{37,38,39}-django{22,30}-drf{310,311,312}, py{37,38,39}-django{31,32}-drf{311,312}, py{39,310}-django{40,41}-drf{313,314} + py311-django{40,41}-drf314 py38-{lint, docs}, py39-djmaster