Skip to content

Commit

Permalink
Merge pull request #135 from Terralego/support_3.13_5.1
Browse files Browse the repository at this point in the history
Support django 5.1 and python 3.13
  • Loading branch information
submarcos authored Nov 26, 2024
2 parents 7c60638 + c6cd615 commit a1588eb
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 20 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8']
python-version: ['3.9']

steps:
- uses: actions/checkout@v4
Expand All @@ -32,18 +32,21 @@ jobs:
flake8 geostore test_geostore
build:
runs-on: ubuntu-20.04
#TODO: Fix when github action do not show failed for the workflow with continue-on-error
# continue-on-error: true
runs-on: ubuntu-latest
needs: [lint]
strategy:
matrix:
python-version: ['3.8', '3.10', '3.12']
django-version: ['3.2.*', '4.2.*', '5.0.*']
python-version: ['3.9', '3.10', '3.13']
django-version: ['4.2.*', '5.1.*']
postgis-image: ['postgis/postgis:12-2.5']
exclude:
- python-version: '3.8'
django-version: '5.0.*'
- postgis-image: 'postgis/postgis:12-2.5'
django-version: '5.1.*'
- python-version: '3.9'
django-version: '5.1.*'
include:
- postgis-image: 'postgis/postgis:13-3.1'
django-version: '5.1.*'

services:
postgres:
Expand Down Expand Up @@ -84,7 +87,8 @@ jobs:
coverage run -a ./manage.py test --settings=test_geostore.settings_with_customs geostore.tests.test_views.test_async_exports
coverage xml -o coverage.xml
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: true
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
CHANGELOG
=========

1.0.0+dev (XXXX-XX-XX)
---------------------------

* Add support for django 5.1
* Add support for python 3.13
* Drop support for django 3.2
* Drop support for python 3.8


1.0.0 (2024-01-12)
---------------------------

Expand Down
20 changes: 18 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
FROM makinacorpus/geodjango:bionic-3.8
FROM python:3.9-bookworm

ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8

RUN apt-get update -qq && apt-get -y upgrade && apt-get install -y -qq \
# std libs
git less nano curl \
ca-certificates \
wget build-essential\
# python basic libs
gettext \
# geodjango
gdal-bin binutils libproj-dev libgdal-dev \
# postgresql
libpq-dev postgresql-client && \
apt-get clean all && rm -rf /var/apt/lists/* && rm -rf /var/cache/apt/*
RUN mkdir -p /code/src

RUN useradd -ms /bin/bash django
Expand All @@ -8,7 +24,7 @@ COPY entrypoint.sh /usr/local/bin/entrypoint.sh

USER django

RUN python3.8 -m venv /code/venv
RUN python3.9 -m venv /code/venv
RUN /code/venv/bin/pip install --no-cache-dir pip setuptools wheel -U

COPY . /code/src
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
services:
postgres:
image: postgis/postgis:12-2.5
Expand Down
2 changes: 0 additions & 2 deletions geostore/tests/test_commands/test_import_osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def test_good_query(self, mocked_get):
type=type_feature,
verbosity=1,
stderr=output)
self.assertIn("Warning 1", output.getvalue())
self.assertEqual(Feature.objects.count(), 2)

@mock.patch('requests.get')
Expand All @@ -77,7 +76,6 @@ def test_good_query_on_existing_layer(self, mocked_get):
type=type_feature,
verbosity=1,
stderr=output)
self.assertIn("Warning 1", output.getvalue())
self.assertEqual(layer.features.count(), 2)

@mock.patch('requests.get')
Expand Down
5 changes: 3 additions & 2 deletions geostore/tests/test_views/test_async_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ def side_effect_now():
with default_storage.open(path_export) as fp:
geojson = json.loads(fp.read())
feature = geojson['features'][0]['geometry']
feature_geom = GEOSGeometry(json.dumps(feature)).ewkt
self.assertEqual(feature_geom, 'SRID=4326;POINT (2.4609375 45.58328975600632)')
feature_geom = GEOSGeometry(json.dumps(feature))
self.assertAlmostEqual(feature_geom.x, 2.4609375)
self.assertAlmostEqual(feature_geom.y, 45.58328975600632)
self.assertEqual(status.HTTP_202_ACCEPTED, response.status_code)


Expand Down
6 changes: 3 additions & 3 deletions geostore/tests/test_views/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ def test_schema_property_match_good(self):

def test_schema_property_match_bad(self):
"""
If schema defined, deny unvalid data
If schema defined, deny invalid data
"""
response = self.client.post(reverse('feature-list', args=[self.property_schema_layer.pk, ]),
data={"geom": "POINT(0 0)",
"properties": {"name": 20,
"age": "wrong data"}})
"age": 10}})
response_json = response.json()
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertIn("properties", response_json)
self.assertIn("wrong data", response_json['properties'][0])
self.assertIn("20 is not of type 'string'", response_json['properties'][0])

def test_schema_property_doesnt_match(self):
"""
Expand Down

0 comments on commit a1588eb

Please sign in to comment.