mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #10832 -- now use reorder_suite in GeoDjango test runner, thanks seanl for ticket & patch; restored original ordering of GEOS tests, as placing last no longer necessary.
				
					
				
			git-svn-id: http://code.djangoproject.com/svn/django/trunk@10602 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -1,4 +1,5 @@ | ||||
| import sys, unittest | ||||
| from django.test.simple import reorder_suite, TestCase | ||||
| from django.utils.importlib import import_module | ||||
|  | ||||
| def geo_suite(): | ||||
| @@ -16,6 +17,10 @@ def geo_suite(): | ||||
|     # The test suite. | ||||
|     s = unittest.TestSuite() | ||||
|  | ||||
|     # Adding the GEOS tests. | ||||
|     from django.contrib.gis.geos import tests as geos_tests | ||||
|     s.addTest(geos_tests.suite()) | ||||
|  | ||||
|     # Tests that require use of a spatial database (e.g., creation of models) | ||||
|     test_apps = ['geoapp', 'relatedapp'] | ||||
|  | ||||
| @@ -48,14 +53,6 @@ def geo_suite(): | ||||
|         tsuite = import_module('django.contrib.gis.tests.' + suite_name) | ||||
|         s.addTest(tsuite.suite()) | ||||
|  | ||||
|     # Adding the GEOS tests _last_.  Doing this because if suite starts | ||||
|     # immediately with this test while after running syncdb, it will cause a | ||||
|     # segmentation fault.  My initial guess is that SpatiaLite is still in | ||||
|     # critical areas of non thread-safe GEOS code when the test suite is run. | ||||
|     # TODO: Confirm my reasoning. Are there other consequences? | ||||
|     from django.contrib.gis.geos import tests as geos_tests | ||||
|     s.addTest(geos_tests.suite()) | ||||
|  | ||||
|     return s, test_apps | ||||
|  | ||||
| def run_gis_tests(test_labels, **kwargs): | ||||
| @@ -158,6 +155,8 @@ def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[], suite= | ||||
|         for test in extra_tests: | ||||
|             suite.addTest(test) | ||||
|  | ||||
|     suite = reorder_suite(suite, (TestCase,)) | ||||
|  | ||||
|     # Executing the tests (including the model tests), and destorying the | ||||
|     # test database after the tests have completed. | ||||
|     result = unittest.TextTestRunner(verbosity=verbosity).run(suite) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user