Skip to content

Commit

Permalink
Moved contrib.gis tests out of contrib.
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Feb 11, 2015
1 parent 5ab327a commit ad0be62
Show file tree
Hide file tree
Showing 99 changed files with 82 additions and 72 deletions.
6 changes: 0 additions & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@ recursive-include django/contrib/admin/templates *
recursive-include django/contrib/admin/static *
recursive-include django/contrib/admindocs/templates *
recursive-include django/contrib/auth/templates *
recursive-include django/contrib/gis/gdal/tests/data *
recursive-include django/contrib/gis/static *
recursive-include django/contrib/gis/templates *
recursive-include django/contrib/gis/tests/data *
recursive-include django/contrib/gis/tests/distapp/fixtures *
recursive-include django/contrib/gis/tests/geoapp/fixtures *
recursive-include django/contrib/gis/tests/geogapp/fixtures *
recursive-include django/contrib/gis/tests/relatedapp/fixtures *
recursive-include django/contrib/sitemaps/templates *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.contrib.gis.db import models
from django.contrib.gis.tests.utils import gisfield_may_be_null
from django.utils.encoding import python_2_unicode_compatible

from ..utils import gisfield_may_be_null


@python_2_unicode_compatible
class NamedModel(models.Model):
Expand All @@ -11,7 +12,6 @@ class NamedModel(models.Model):

class Meta:
abstract = True
app_label = 'distapp'

def __str__(self):
return self.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.measure import D # alias for Distance
from django.contrib.gis.tests.utils import (
no_oracle, oracle, postgis, spatialite,
)
from django.db import connection
from django.db.models import Q
from django.test import TestCase, skipUnlessDBFeature

from ..utils import no_oracle, oracle, postgis, spatialite

if HAS_GEOS:
from django.contrib.gis.geos import GEOSGeometry, LineString

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from unittest import skipUnless

from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import (
TEST_DATA, TestDS, get_ds_file,
)

from ..test_data import TEST_DATA, TestDS, get_ds_file

if HAS_GDAL:
from django.contrib.gis.gdal import DataSource, Envelope, OGRGeometry, GDALException, OGRIndexError, GDAL_VERSION
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from unittest import skipUnless

from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import TestDataMixin
from django.utils.six.moves import range

from ..test_data import TestDataMixin

try:
from django.utils.six.moves import cPickle as pickle
except ImportError:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class NamedModel(models.Model):

class Meta:
abstract = True
app_label = 'geo3d'

def __str__(self):
return self.name
Expand Down Expand Up @@ -50,7 +49,6 @@ class SimpleModel(models.Model):

class Meta:
abstract = True
app_label = 'geo3d'


class Point2D(SimpleModel):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.contrib.gis.db import models
from django.contrib.gis.tests.utils import gisfield_may_be_null
from django.utils.encoding import python_2_unicode_compatible

from ..utils import gisfield_may_be_null


@python_2_unicode_compatible
class NamedModel(models.Model):
Expand All @@ -11,7 +12,6 @@ class NamedModel(models.Model):

class Meta:
abstract = True
app_label = 'geoapp'

def __str__(self):
return self.name
Expand All @@ -24,6 +24,9 @@ class Country(NamedModel):
class City(NamedModel):
point = models.PointField()

class Meta:
app_label = 'geoapp'


# This is an inherited model from City
class PennsylvaniaCity(City):
Expand All @@ -41,6 +44,9 @@ class Meta:
class State(NamedModel):
poly = models.PolygonField(null=gisfield_may_be_null) # Allowing NULL geometries here.

class Meta:
app_label = 'geoapp'


class Track(NamedModel):
line = models.LineStringField()
Expand All @@ -57,9 +63,6 @@ class Truth(models.Model):

objects = models.GeoManager()

class Meta:
app_label = 'geoapp'


class Feature(NamedModel):
geom = models.GeometryField()
Expand All @@ -70,9 +73,6 @@ class MinusOneSRID(models.Model):

objects = models.GeoManager()

class Meta:
app_label = 'geoapp'


class NonConcreteField(models.IntegerField):

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@modify_settings(INSTALLED_APPS={'append': 'django.contrib.sites'})
@override_settings(ROOT_URLCONF='django.contrib.gis.tests.geoapp.urls')
@override_settings(ROOT_URLCONF='gis_tests.geoapp.urls')
@skipUnlessDBFeature("gis_enabled")
class GeoFeedTest(TestCase):
fixtures = ['initial']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.shortcuts import render_to_kmz
from django.contrib.gis.tests.utils import no_oracle
from django.db.models import Count, Min
from django.test import TestCase, skipUnlessDBFeature

from ..utils import no_oracle

if HAS_GEOS:
from django.contrib.gis.db.models import Extent
from .models import City, PennsylvaniaCity, State, Truth
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


@modify_settings(INSTALLED_APPS={'append': ['django.contrib.sites', 'django.contrib.sitemaps']})
@override_settings(ROOT_URLCONF='django.contrib.gis.tests.geoapp.urls')
@override_settings(ROOT_URLCONF='gis_tests.geoapp.urls')
@skipUnlessDBFeature("gis_enabled")
class GeoSitemapTest(TestCase):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

from django.contrib.gis import gdal
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import (
no_oracle, oracle, postgis, spatialite,
)
from django.core.management import call_command
from django.db import connection
from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning

from ..utils import no_oracle, oracle, postgis, spatialite

if HAS_GEOS:
from django.contrib.gis.db.models import Extent, MakeLine, Union
from django.contrib.gis.geos import (fromstr, GEOSGeometry,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class NamedModel(models.Model):

class Meta:
abstract = True
app_label = 'geogapp'

def __str__(self):
return self.name
Expand All @@ -19,6 +18,9 @@ def __str__(self):
class City(NamedModel):
point = models.PointField(geography=True)

class Meta:
app_label = 'geogapp'


class Zipcode(NamedModel):
code = models.CharField(max_length=10)
Expand All @@ -29,5 +31,8 @@ class County(NamedModel):
state = models.CharField(max_length=20)
mpoly = models.MultiPolygonField(geography=True)

class Meta:
app_label = 'geogapp'

def __str__(self):
return ' County, '.join([self.name, self.state])
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.measure import D
from django.contrib.gis.tests.utils import oracle, postgis
from django.test import TestCase, skipUnlessDBFeature
from django.utils._os import upath

from ..utils import oracle, postgis

if HAS_GEOS:
from .models import City, County, Zipcode

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@
from unittest import skipUnless

from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import TestDataMixin
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.shortcuts import numpy
from django.utils import six
from django.utils.encoding import force_bytes
from django.utils.six.moves import range

from .. import HAS_GEOS
from ..test_data import TestDataMixin

if HAS_GEOS:
from .. import (GEOSException, GEOSIndexError, GEOSGeometry,
GeometryCollection, Point, MultiPoint, Polygon, MultiPolygon, LinearRing,
LineString, MultiLineString, fromfile, fromstr, geos_version_info)
from ..base import gdal, GEOSBase
from django.contrib.gis.geos import (
GEOSException, GEOSIndexError, GEOSGeometry, GeometryCollection, Point,
MultiPoint, Polygon, MultiPolygon, LinearRing, LineString,
MultiLineString, fromfile, fromstr, geos_version_info,
)
from django.contrib.gis.geos.base import gdal, GEOSBase


@skipUnless(HAS_GEOS, "Geos is required.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import unittest
from unittest import skipUnless

from .. import HAS_GEOS
from django.contrib.gis.geos import HAS_GEOS

if HAS_GEOS:
from .. import fromstr, LinearRing, LineString, MultiPoint, Point, Polygon
from ..error import GEOSIndexError
from django.contrib.gis.geos import (
fromstr, LinearRing, LineString, MultiPoint, Point, Polygon,
)
from django.contrib.gis.geos.error import GEOSIndexError


if HAS_GEOS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import unittest
from unittest import skipUnless

from django.contrib.gis.geos import HAS_GEOS
from django.utils.six import memoryview

from ..import HAS_GEOS # isort:skip

if HAS_GEOS:
from .. import GEOSGeometry, WKTReader, WKTWriter, WKBReader, WKBWriter
from django.contrib.gis.geos import (
GEOSGeometry, WKTReader, WKTWriter, WKBReader, WKBWriter,
)


@skipUnless(HAS_GEOS, "Geos is required.")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MigrateTests(TransactionTestCase):
"""
Tests running the migrate command in Geodjango.
"""
available_apps = ["django.contrib.gis.tests.gis_migrations"]
available_apps = ["gis_tests.gis_migrations"]

def get_table_description(self, table):
with connection.cursor() as cursor:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from __future__ import unicode_literals

from django.contrib.gis.tests.utils import mysql
from django.db import connection, migrations, models
from django.db.migrations.migration import Migration
from django.db.migrations.state import ProjectState
from django.test import TransactionTestCase, skipUnlessDBFeature

from ..utils import mysql

if connection.features.gis_enabled:
from django.contrib.gis.db.models import fields
try:
Expand All @@ -17,7 +18,7 @@

@skipUnlessDBFeature("gis_enabled")
class OperationTests(TransactionTestCase):
available_apps = ["django.contrib.gis.tests.gis_migrations"]
available_apps = ["gis_tests.gis_migrations"]

def tearDown(self):
# Delete table after testing
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ class AllOGRFields(models.Model):
point = models.PointField()

objects = models.GeoManager()

class Meta:
app_label = 'inspectapp'
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
from unittest import skipUnless

from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import TEST_DATA
from django.core.management import call_command
from django.db import connection, connections
from django.test import TestCase, skipUnlessDBFeature
from django.utils.six import StringIO

from ..test_data import TEST_DATA

if HAS_GDAL:
from django.contrib.gis.gdal import Driver, GDALException
from django.contrib.gis.utils.ogrinspect import ogrinspect
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class NamedModel(models.Model):

class Meta:
abstract = True
app_label = 'layermap'

def __str__(self):
return self.name
Expand All @@ -37,11 +36,17 @@ class City(NamedModel):
dt = models.DateField()
point = models.PointField()

class Meta:
app_label = 'layermap'


class Interstate(NamedModel):
length = models.DecimalField(max_digits=6, decimal_places=2)
path = models.LineStringField()

class Meta:
app_label = 'layermap'


# Same as `City` above, but for testing model inheritance.
class CityBase(NamedModel):
Expand All @@ -67,9 +72,6 @@ class Meta(ICity1.Meta):
class Invalid(models.Model):
point = models.PointField()

class Meta:
app_label = 'layermap'


# Mapping dictionaries for the models above.
co_mapping = {
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit ad0be62

Please sign in to comment.