diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-10-10 21:41:12 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-10-10 21:41:12 +0000 |
| commit | b21ea0a8363203087e5bcb3004735db0d4143490 (patch) | |
| tree | c2bb47f9cbc9a8635cb6c9691a88744b6773da3c /django | |
| parent | c1851350687eb8aed5fd51db37c2eca35b2167cd (diff) | |
More be-nice-to-the-buildbot: be better about cleaning up files created by the cache/session tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9224 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/sessions/tests.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/django/contrib/sessions/tests.py b/django/contrib/sessions/tests.py index 5efc17df00..cf6922449f 100644 --- a/django/contrib/sessions/tests.py +++ b/django/contrib/sessions/tests.py @@ -54,6 +54,11 @@ True >>> db_session.save() >>> DatabaseSession('1').get('cat') +# Do file session tests in an isolated directory, and kill it after we're done. +>>> original_session_file_path = settings.SESSION_FILE_PATH +>>> import tempfile +>>> temp_session_store = settings.SESSION_FILE_PATH = tempfile.mkdtemp() + >>> file_session = FileSession() >>> file_session.modified False @@ -105,6 +110,17 @@ Traceback (innermost last): ... ImproperlyConfigured: 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. +# Clean up after the file tests +>>> settings.SESSION_FILE_PATH = original_session_file_path +>>> import shutil +>>> shutil.rmtree(temp_session_store) + +# +# Cache-based tests +# NB: be careful to delete any sessions created; stale sessions fill up the +# /tmp and eventually overwhelm it after lots of runs (think buildbots) +# + >>> cache_session = CacheSession() >>> cache_session.modified False @@ -144,7 +160,7 @@ True >>> Session.objects.filter(pk=cache_session.session_key).delete() >>> cache_session = CacheSession(cache_session.session_key) >>> cache_session.save() ->>> CacheSession('1').get('cat') +>>> cache_session.delete(cache_session.session_key) >>> s = SessionBase() >>> s._session['some key'] = 'exists' # Pre-populate the session with some data |
