Django

Code

Show
Ignore:
Timestamp:
10/10/08 16:41:12 (3 months ago)
Author:
jacob
Message:

More be-nice-to-the-buildbot: be better about cleaning up files created by the cache/session tests.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/sessions/tests.py

    r8459 r9224  
    5555>>> DatabaseSession('1').get('cat') 
    5656 
     57# Do file session tests in an isolated directory, and kill it after we're done. 
     58>>> original_session_file_path = settings.SESSION_FILE_PATH 
     59>>> import tempfile 
     60>>> temp_session_store = settings.SESSION_FILE_PATH = tempfile.mkdtemp() 
     61 
    5762>>> file_session = FileSession() 
    5863>>> file_session.modified 
     
    106111ImproperlyConfigured: The session storage path '/if/this/directory/exists/you/have/a/weird/computer' doesn't exist. Please set your SESSION_FILE_PATH setting to an existing directory in which Django can store session data. 
    107112 
     113# Clean up after the file tests 
     114>>> settings.SESSION_FILE_PATH = original_session_file_path 
     115>>> import shutil 
     116>>> shutil.rmtree(temp_session_store) 
     117 
     118# 
     119# Cache-based tests 
     120# NB: be careful to delete any sessions created; stale sessions fill up the 
     121# /tmp and eventually overwhelm it after lots of runs (think buildbots) 
     122# 
     123 
    108124>>> cache_session = CacheSession() 
    109125>>> cache_session.modified 
     
    145161>>> cache_session = CacheSession(cache_session.session_key) 
    146162>>> cache_session.save() 
    147 >>> CacheSession('1').get('cat'
     163>>> cache_session.delete(cache_session.session_key
    148164 
    149165>>> s = SessionBase()