Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#22632 closed Cleanup/optimization (fixed)

Spatial backend tests uses hardcoded set of backends

Reported by: Jani Tiainen Owned by: nobody
Component: GIS Version: dev
Severity: Normal Keywords: gis database testing
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In django.contrib.gis.tests.utils is hardcoded parts that spatial backend must be located inside 'django.contrib.gis' and there are bunch of hardcoded imports depending on selected backend.

This makes impossible to test any custom backend for GIS options.

Change History (12)

comment:1 by Claude Paroz, 10 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

You are referring to has_spatial_db, I suppose. You are right, however it's a bit tricky because that utility is used many times during test modules import time. We have to be careful not to have to load too much things to determine if the backend is gis-enabled or not.

comment:2 by Claude Paroz, 10 years ago

One more thing, we should follow the work recently done to abstract the backend name and concentrate on backend capabilities instead. See c70a61eb49e4ed8f3b2a5011a7a5e6cda43c8598 and commits around it.

comment:3 by Claude Paroz, 10 years ago

Has patch: set
Version: 1.6master

In that pull request (https://github.com/django/django/pull/3080), I set the base to use connection.features to test for various GIS features. As a start and proof of concept, I got rid of HAS_SPATIAL_DB. Reviews welcome.

comment:4 by Claude Paroz <claude@…>, 10 years ago

In 6295ea0027d808dcc309aa42cc58f6fdf172c3fc:

Replaced HAS_SPATIAL_DB by testing database feature

Refs #22632. This should be the base for using more database
features to exclude specific backends in GIS tests.
Thanks Tim Graham for the review.

comment:6 by Claude Paroz <claude@…>, 10 years ago

In a7d964ab87ad7352af3e33b8f3c12e4643a80f02:

Replaced no_spatialite by connection features

Refs #22632. Thanks Tim Graham for the review.

comment:7 by Claude Paroz <claude@…>, 10 years ago

In ba1d707b0f5666809b09bb8234f2df64bf0d7490:

Replaced no_mysql by connection features

Refs #22632. Thanks Tim Graham for the review.

comment:8 by Claude Paroz, 10 years ago

A few more here: https://github.com/django/django/pull/3109

Note that I'm not able to test those changes on Oracle GIS. If anyone has this ability and some time to spent, feel free to help! I also won't able to tackle the remaining no_oracle flags.

comment:9 by Claude Paroz <claude@…>, 10 years ago

In 60428ed5db76f509f4a0eb737d96b4f0ae6b0ad5:

Removed some more hardcoded backends in GIS tests

Refs #22632. Thanks Tim Graham for the review.

comment:10 by Claude Paroz, 10 years ago

Resolution: fixed
Status: newclosed

I think that now about 90% of hardcoded references to backends have been replaced by database features, which should allow custom backends to run GIS tests. There is probably some work remaining, but I suggest now to open individual tickets for such issues.

comment:11 by Tim Graham <timograham@…>, 10 years ago

In 6c1a0581abd9cf21fa37c6c9e9937986da45005c:

Added a feature flag for add_srs_entry support; refs #22632 and #23504.

comment:12 by Tim Graham <timograham@…>, 10 years ago

In 33e817a6d8b163aa6e8a2fb15d7269d1ecbbcf59:

Added feature flag for geometry_field_introspection; refs #22632 and #23504.

Note: See TracTickets for help on using tickets.
Back to Top