1
0
mirror of https://github.com/django/django.git synced 2025-07-05 10:19:20 +00:00

[gsoc2009-testing] Cleanup threads after tests run. Ensure the django admin is populated before windmill tests start

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/test-improvements@11145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Kevin Kubasik 2009-07-01 22:27:02 +00:00
parent b1b9d34fa5
commit 772452ccc7
3 changed files with 17 additions and 15 deletions

View File

@ -55,11 +55,11 @@ class TestServerThread(threading.Thread):
# Must do database stuff in this new thread if database in memory. # Must do database stuff in this new thread if database in memory.
from django.conf import settings from django.conf import settings
if settings.DATABASE_ENGINE == 'sqlite3' \ #if settings.DATABASE_ENGINE == 'sqlite3' \
and (not settings.TEST_DATABASE_NAME or settings.TEST_DATABASE_NAME == ':memory:'): # and (not settings.TEST_DATABASE_NAME or settings.TEST_DATABASE_NAME == ':memory:'):
from django.db import connection from django.db import connection
print 'Creating test DB' print 'Creating test DB'
db_name = connection.creation.create_test_db(0) db_name = connection.creation.create_test_db(0,autoclobber=True)
#call_command('syncdb', 0, 0) #call_command('syncdb', 0, 0)
# Import the fixture data into the test database. # Import the fixture data into the test database.
if hasattr(self, 'fixtures'): if hasattr(self, 'fixtures'):

View File

@ -35,12 +35,12 @@ class AdminViewBasicTest(TestCase):
def setUp(self): def setUp(self):
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.register(TestSection)
self.client.login(username='super', password='secret') self.client.login(username='super', password='secret')
def tearDown(self): def tearDown(self):
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.unregister(TestSection)
self.client.logout() self.client.logout()
def testTrailingSlashRequired(self): def testTrailingSlashRequired(self):

View File

@ -274,7 +274,8 @@ def django_tests(verbosity, interactive, test_labels):
print 'Waiting for threaded server to come online.' print 'Waiting for threaded server to come online.'
started.wait() started.wait()
print 'DB Ready, Server online.' print 'DB Ready, Server online.'
from django.contrib import admin
admin.autodiscover()
# Set the testing URL based on what available port we get. # Set the testing URL based on what available port we get.
@ -331,6 +332,7 @@ def django_tests(verbosity, interactive, test_labels):
#count = count + 1 #count = count + 1
#setup_module(tests[count][1]) #setup_module(tests[count][1])
teardown_module(tests[0][1]) teardown_module(tests[0][1])
server_container.stop_test_server()
# sys.argv = [wmtests[0],] # sys.argv = [wmtests[0],]
# bin.cli() # bin.cli()