From 4841e9756484a90b4f68a22294a9b39e3b94d187 Mon Sep 17 00:00:00 2001 From: "Mostafa M. Mohamed" Date: Mon, 12 Sep 2022 23:21:29 +0200 Subject: [PATCH] added tests for django v4. --- Dockerfile.temp | 3 ++- README.md | 4 ++++ djenerator/core/utils.py | 10 +++++++--- test-all-versions | 8 ++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Dockerfile.temp b/Dockerfile.temp index bccb9ad..68bc8e4 100644 --- a/Dockerfile.temp +++ b/Dockerfile.temp @@ -1,6 +1,7 @@ -FROM python:3.5-stretch +FROM python:3.5-alpine ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 +RUN apk add build-base libc-dev gcc python3-dev jpeg-dev zlib-dev RUN chown -R root:root /usr/local/lib/python* RUN pip3 install --no-cache --pre Django==2.2 pillow COPY djenerator/ /tmp/djenerator diff --git a/README.md b/README.md index 6c230eb..d8200ab 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,10 @@ The following combinations are tested: | 2.2.28 | 3.7 | ✅ | | 3.2.15 | 3.6 | ✅ | | 3.2.15 | 3.7 | ✅ | +| 4.0.7 | 3.8 | ✅ | +| 4.0.7 | 3.9 | ✅ | +| 4.1.1 | 3.8 | ✅ | +| 4.1.1 | 3.9 | ✅ | ## Requirements diff --git a/djenerator/core/utils.py b/djenerator/core/utils.py index bb12568..2e34c21 100644 --- a/djenerator/core/utils.py +++ b/djenerator/core/utils.py @@ -258,6 +258,10 @@ def get_timezone(tz: str): try: import zoneinfo return zoneinfo.ZoneInfo(tz) - except Exception: - import pytz - return pytz.timezone(tz) + except ImportError: + try: + from backports import zoneinfo + return zoneinfo.ZoneInfo(tz) + except Exception: + import pytz + return pytz.timezone(tz) diff --git a/test-all-versions b/test-all-versions index f08b904..3e38fe5 100755 --- a/test-all-versions +++ b/test-all-versions @@ -17,4 +17,12 @@ cat Dockerfile.temp | sed "s/3.5/3.6/" | sed "s/2.2/3.2.15/" > Dockerfile && ma head -n 1 Dockerfile && head -n 5 Dockerfile | tail -n 1 && echo -e "\n\n" cat Dockerfile.temp | sed "s/3.5/3.7/" | sed "s/2.2/3.2.15/" > Dockerfile && make docker-test head -n 1 Dockerfile && head -n 5 Dockerfile | tail -n 1 && echo -e "\n\n" +cat Dockerfile.temp | sed "s/3.5/3.8/" | sed "s/2.2/4.0.7/" > Dockerfile && make docker-test +head -n 1 Dockerfile && head -n 5 Dockerfile | tail -n 1 && echo -e "\n\n" +cat Dockerfile.temp | sed "s/3.5/3.8/" | sed "s/2.2/4.1.1/" > Dockerfile && make docker-test +head -n 1 Dockerfile && head -n 5 Dockerfile | tail -n 1 && echo -e "\n\n" +cat Dockerfile.temp | sed "s/3.5/3.9/" | sed "s/2.2/4.0.7/" > Dockerfile && make docker-test +head -n 1 Dockerfile && head -n 5 Dockerfile | tail -n 1 && echo -e "\n\n" +cat Dockerfile.temp | sed "s/3.5/3.9/" | sed "s/2.2/4.1.1/" > Dockerfile && make docker-test +head -n 1 Dockerfile && head -n 5 Dockerfile | tail -n 1 && echo -e "\n\n" rm Dockerfile