Show
Ignore:
Timestamp:
09/09/08 14:55:25 (18 months ago)
Author:
JensDiemer
Message:

django updates

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid_project/tests/__init__.py

    r1664 r1749  
    100100os.environ['DJANGO_SETTINGS_MODULE'] = "PyLucid.settings" 
    101101 
    102 from django.test.utils import setup_test_environment, teardown_test_environment 
    103 from django.test.utils import create_test_db, destroy_test_db 
    104  
    105102from django.conf import settings 
    106  
     103from django.db import connection 
    107104from django.core.cache import cache 
    108105from django.test import TestCase as DjangoTestCase 
    109106from django.contrib.auth.models import User, UNUSABLE_PASSWORD 
     107from django.test.utils import setup_test_environment, teardown_test_environment 
    110108 
    111109from tests.utils.BrowserDebug import debug_response 
     
    117115from PyLucid.models import Page, Style, Template, Plugin 
    118116from PyLucid.system.plugin_manager import auto_install_plugins, install_plugin 
    119  
    120117 
    121118# Display invalid (e.g. misspelled, unused) template variables 
     
    533530def remove_unittest_plugin(): 
    534531    print "remove unittest plugin (%s)" % TEST_PLUGIN_DST 
    535     shutil.rmtree(os.path.abspath(TEST_PLUGIN_DST)) 
     532    try: 
     533        shutil.rmtree(os.path.abspath(TEST_PLUGIN_DST)) 
     534    except Exception, err: 
     535        print "Error:", err 
    536536 
    537537 
     
    742742    """ 
    743743    print "test start." 
    744     settings.DEBUG = False 
     744    settings.DEBUG = False    
    745745    setup_test_environment() 
    746746    old_name = settings.DATABASE_NAME 
    747     db_name = create_test_db(verbosity=1, autoclobber=not interactive) 
     747    db_name = connection.creation.create_test_db( 
     748        verbosity=1, autoclobber=not interactive 
     749    ) 
     750    print "Test database '%s' created" % db_name   
    748751    init_pyluciddb(verbosity==2) 
    749752    suite = get_tests(test_labels, verbosity==2) 
    750753    print "Running tests" 
    751754    result = unittest.TextTestRunner(verbosity=verbosity).run(suite) 
    752     destroy_test_db(old_name, verbosity) 
     755    connection.creation.destroy_test_db(old_name, verbosity) 
    753756    teardown_test_environment() 
    754757    teardown_pylucid() 
     
    758761 
    759762print "PyLucid unittest" 
     763#run_tests(test_labels=["test_plugin_api",])