From e0a665e1213b1124f1c58dbfe048e38d8d89b061 Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Fri, 14 Sep 2007 22:36:51 +0000 Subject: [PATCH] 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 --- django/contrib/gis/tests/__init__.py | 4 ++-- django/contrib/gis/tests/test_gdal_geom.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/django/contrib/gis/tests/__init__.py b/django/contrib/gis/tests/__init__.py index efe356d8e5..f2633ae6fb 100644 --- a/django/contrib/gis/tests/__init__.py +++ b/django/contrib/gis/tests/__init__.py @@ -17,7 +17,7 @@ def suite(): "Builds a test suite for the GIS package." s = TestSuite() 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()) return s @@ -69,7 +69,7 @@ def run_tests(module_list, verbosity=1, interactive=True): for test_model in test_models: module_name = 'django.contrib.gis.tests.%s' % test_model 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()) # Resetting the loaded flag to take into account what we appended to the INSTALLED_APPS diff --git a/django/contrib/gis/tests/test_gdal_geom.py b/django/contrib/gis/tests/test_gdal_geom.py index 8d143dd825..53068e4cba 100644 --- a/django/contrib/gis/tests/test_gdal_geom.py +++ b/django/contrib/gis/tests/test_gdal_geom.py @@ -105,6 +105,7 @@ class OGRGeomTest(unittest.TestCase): # 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))') self.assertEqual(8, poly.point_count) + print "\nBEGIN - expecting IllegalArgumentException; safe to ignore.\n" try: c = poly.centroid except OGRException: @@ -112,6 +113,7 @@ class OGRGeomTest(unittest.TestCase): pass else: self.fail('Should have raised an OGRException!') + print "\nEND - expecting IllegalArgumentException; safe to ignore.\n" # Closing the rings poly.close_rings()