mirror of https://github.com/django/django.git
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:
parent
aeaba06bf4
commit
be11bd40d4
|
@ -1,4 +1,5 @@
|
||||||
import sys, unittest
|
import sys, unittest
|
||||||
|
from django.test.simple import reorder_suite, TestCase
|
||||||
from django.utils.importlib import import_module
|
from django.utils.importlib import import_module
|
||||||
|
|
||||||
def geo_suite():
|
def geo_suite():
|
||||||
|
@ -16,6 +17,10 @@ def geo_suite():
|
||||||
# The test suite.
|
# The test suite.
|
||||||
s = unittest.TestSuite()
|
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)
|
# Tests that require use of a spatial database (e.g., creation of models)
|
||||||
test_apps = ['geoapp', 'relatedapp']
|
test_apps = ['geoapp', 'relatedapp']
|
||||||
|
|
||||||
|
@ -48,14 +53,6 @@ def geo_suite():
|
||||||
tsuite = import_module('django.contrib.gis.tests.' + suite_name)
|
tsuite = import_module('django.contrib.gis.tests.' + suite_name)
|
||||||
s.addTest(tsuite.suite())
|
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
|
return s, test_apps
|
||||||
|
|
||||||
def run_gis_tests(test_labels, **kwargs):
|
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:
|
for test in extra_tests:
|
||||||
suite.addTest(test)
|
suite.addTest(test)
|
||||||
|
|
||||||
|
suite = reorder_suite(suite, (TestCase,))
|
||||||
|
|
||||||
# Executing the tests (including the model tests), and destorying the
|
# Executing the tests (including the model tests), and destorying the
|
||||||
# test database after the tests have completed.
|
# test database after the tests have completed.
|
||||||
result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
|
result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
|
||||||
|
|
Loading…
Reference in New Issue