1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

gis: Fixed #5436, for Python 2.4 test runner compatibility with patch from rcoup; GDAL tests now print that IllegalArgumentException is expected.

git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6237 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Justin Bronn 2007-09-14 22:36:51 +00:00
parent 7c79d21eb4
commit e0a665e121
2 changed files with 4 additions and 2 deletions

View File

@ -17,7 +17,7 @@ def suite():
"Builds a test suite for the GIS package." "Builds a test suite for the GIS package."
s = TestSuite() s = TestSuite()
for test_suite in test_suite_names: for test_suite in test_suite_names:
tsuite = getattr(__import__('django.contrib.gis.tests', fromlist=[test_suite]),test_suite) tsuite = getattr(__import__('django.contrib.gis.tests', globals(), locals(), [test_suite]),test_suite)
s.addTest(tsuite.suite()) s.addTest(tsuite.suite())
return s return s
@ -69,7 +69,7 @@ def run_tests(module_list, verbosity=1, interactive=True):
for test_model in test_models: for test_model in test_models:
module_name = 'django.contrib.gis.tests.%s' % test_model module_name = 'django.contrib.gis.tests.%s' % test_model
settings.INSTALLED_APPS.append(module_name) settings.INSTALLED_APPS.append(module_name)
tsuite = getattr(__import__('django.contrib.gis.tests.%s' % test_model, fromlist=['tests']), 'tests') tsuite = getattr(__import__('django.contrib.gis.tests.%s' % test_model, globals(), locals(), ['tests']), 'tests')
test_suite.addTest(tsuite.suite()) test_suite.addTest(tsuite.suite())
# Resetting the loaded flag to take into account what we appended to the INSTALLED_APPS # Resetting the loaded flag to take into account what we appended to the INSTALLED_APPS

View File

@ -105,6 +105,7 @@ class OGRGeomTest(unittest.TestCase):
# Both rings in this geometry are not closed. # Both rings in this geometry are not closed.
poly = OGRGeometry('POLYGON((0 0, 5 0, 5 5, 0 5), (1 1, 2 1, 2 2, 2 1))') poly = OGRGeometry('POLYGON((0 0, 5 0, 5 5, 0 5), (1 1, 2 1, 2 2, 2 1))')
self.assertEqual(8, poly.point_count) self.assertEqual(8, poly.point_count)
print "\nBEGIN - expecting IllegalArgumentException; safe to ignore.\n"
try: try:
c = poly.centroid c = poly.centroid
except OGRException: except OGRException:
@ -112,6 +113,7 @@ class OGRGeomTest(unittest.TestCase):
pass pass
else: else:
self.fail('Should have raised an OGRException!') self.fail('Should have raised an OGRException!')
print "\nEND - expecting IllegalArgumentException; safe to ignore.\n"
# Closing the rings # Closing the rings
poly.close_rings() poly.close_rings()