def build_suite(self, test_labels, extra_tests=None, **kwargs): """ This method is overridden to construct a suite consisting only of tests for GeoDjango. """ suite = unittest.TestSuite() # Adding the GEOS tests. from django.contrib.gis.geos import tests as geos_tests suite.addTest(geos_tests.suite()) # Adding the measurment tests. from django.contrib.gis.tests import test_measure suite.addTest(test_measure.suite()) # Adding GDAL tests, and any test suite that depends on GDAL, to the # suite if GDAL is available. from django.contrib.gis.gdal import HAS_GDAL if HAS_GDAL: from django.contrib.gis.gdal import tests as gdal_tests suite.addTest(gdal_tests.suite()) from django.contrib.gis.tests import test_spatialrefsys, test_geoforms suite.addTest(test_spatialrefsys.suite()) suite.addTest(test_geoforms.suite()) else: sys.stderr.write("GDAL not available - no tests requiring GDAL will be run.\n") # Add GeoIP tests to the suite, if the library and data is available. from django.contrib.gis.utils import HAS_GEOIP if HAS_GEOIP and hasattr(settings, "GEOIP_PATH"): from django.contrib.gis.tests import test_geoip suite.addTest(test_geoip.suite()) # Finally, adding the suites for each of the GeoDjango test apps. for app_name in self.geo_apps: suite.addTest(build_suite(get_app(app_name))) return suite
def geodjango_suite(apps=True): """ Returns a TestSuite consisting only of GeoDjango tests that can be run. """ import sys from django.db.models import get_app suite = unittest.TestSuite() # Adding the GEOS tests. from django.contrib.gis.geos import tests as geos_tests suite.addTest(geos_tests.suite()) # Adding the measurment tests. from django.contrib.gis.tests import test_measure suite.addTest(test_measure.suite()) # Adding GDAL tests, and any test suite that depends on GDAL, to the # suite if GDAL is available. from django.contrib.gis.gdal import HAS_GDAL if HAS_GDAL: from django.contrib.gis.gdal import tests as gdal_tests suite.addTest(gdal_tests.suite()) from django.contrib.gis.tests import test_spatialrefsys, test_geoforms suite.addTest(test_spatialrefsys.suite()) suite.addTest(test_geoforms.suite()) else: sys.stderr.write( 'GDAL not available - no tests requiring GDAL will be run.\n') # Add GeoIP tests to the suite, if the library and data is available. from django.contrib.gis.utils import HAS_GEOIP if HAS_GEOIP and hasattr(settings, 'GEOIP_PATH'): from django.contrib.gis.tests import test_geoip suite.addTest(test_geoip.suite()) # Finally, adding the suites for each of the GeoDjango test apps. if apps: for app_name in geo_apps(namespace=False): suite.addTest(build_suite(get_app(app_name))) return suite
def geodjango_suite(apps=True): """ Returns a TestSuite consisting only of GeoDjango tests that can be run. """ import sys from django.db.models import get_app suite = unittest.TestSuite() # Adding the GEOS tests. from django.contrib.gis.geos import tests as geos_tests suite.addTest(geos_tests.suite()) # Adding the measurment tests. from django.contrib.gis.tests import test_measure suite.addTest(test_measure.suite()) # Adding GDAL tests, and any test suite that depends on GDAL, to the # suite if GDAL is available. from django.contrib.gis.gdal import HAS_GDAL if HAS_GDAL: from django.contrib.gis.gdal import tests as gdal_tests suite.addTest(gdal_tests.suite()) from django.contrib.gis.tests import test_spatialrefsys, test_geoforms suite.addTest(test_spatialrefsys.suite()) suite.addTest(test_geoforms.suite()) else: sys.stderr.write('GDAL not available - no tests requiring GDAL will be run.\n') # Add GeoIP tests to the suite, if the library and data is available. from django.contrib.gis.utils import HAS_GEOIP if HAS_GEOIP and hasattr(settings, 'GEOIP_PATH'): from django.contrib.gis.tests import test_geoip suite.addTest(test_geoip.suite()) # Finally, adding the suites for each of the GeoDjango test apps. if apps: for app_name in geo_apps(namespace=False): suite.addTest(build_suite(get_app(app_name))) return suite
def build_suite(self, test_labels, extra_tests=None, **kwargs): """ This method is overridden to construct a suite consisting only of tests for GeoDjango. """ suite = unittest.TestSuite() # Adding the GEOS tests. from django.contrib.gis.geos import tests as geos_tests suite.addTest(geos_tests.suite()) # Adding the measurment tests. from django.contrib.gis.tests import test_measure suite.addTest(test_measure.suite()) # Adding GDAL tests, and any test suite that depends on GDAL, to the # suite if GDAL is available. from django.contrib.gis.gdal import HAS_GDAL if HAS_GDAL: from django.contrib.gis.gdal import tests as gdal_tests suite.addTest(gdal_tests.suite()) from django.contrib.gis.tests import test_spatialrefsys, test_geoforms suite.addTest(test_spatialrefsys.suite()) suite.addTest(test_geoforms.suite()) else: sys.stderr.write( 'GDAL not available - no tests requiring GDAL will be run.\n') # Add GeoIP tests to the suite, if the library and data is available. from django.contrib.gis.utils import HAS_GEOIP if HAS_GEOIP and hasattr(settings, 'GEOIP_PATH'): from django.contrib.gis.tests import test_geoip suite.addTest(test_geoip.suite()) # Finally, adding the suites for each of the GeoDjango test apps. for app_name in self.geo_apps: suite.addTest(build_suite(get_app(app_name))) return suite