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,18 +55,18 @@ class TestServerThread(threading.Thread):
# Must do database stuff in this new thread if database in memory.
from django.conf import settings
if settings.DATABASE_ENGINE == 'sqlite3' \
and (not settings.TEST_DATABASE_NAME or settings.TEST_DATABASE_NAME == ':memory:'):
from django.db import connection
print 'Creating test DB'
db_name = connection.creation.create_test_db(0)
#call_command('syncdb', 0, 0)
# Import the fixture data into the test database.
if hasattr(self, 'fixtures'):
print 'Loading fixtures.'
# We have to use this slightly awkward syntax due to the fact
# that we're using *args and **kwargs together.
call_command('loaddata', *self.fixtures, **{'verbosity': 0})
#if settings.DATABASE_ENGINE == 'sqlite3' \
# and (not settings.TEST_DATABASE_NAME or settings.TEST_DATABASE_NAME == ':memory:'):
from django.db import connection
print 'Creating test DB'
db_name = connection.creation.create_test_db(0,autoclobber=True)
#call_command('syncdb', 0, 0)
# Import the fixture data into the test database.
if hasattr(self, 'fixtures'):
print 'Loading fixtures.'
# We have to use this slightly awkward syntax due to the fact
# that we're using *args and **kwargs together.
call_command('loaddata', *self.fixtures, **{'verbosity': 0})
try:
print "running thread"

View File

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

View File

@ -274,7 +274,8 @@ def django_tests(verbosity, interactive, test_labels):
print 'Waiting for threaded server to come online.'
started.wait()
print 'DB Ready, Server online.'
from django.contrib import admin
admin.autodiscover()
# 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
#setup_module(tests[count][1])
teardown_module(tests[0][1])
server_container.stop_test_server()
# sys.argv = [wmtests[0],]
# bin.cli()