Changeset 1510 for trunk/pylucid/PyLucid/install/tests.py
- Timestamp:
- 03/27/08 16:59:44 (2 years ago)
- Files:
-
- 1 modified
-
trunk/pylucid/PyLucid/install/tests.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pylucid/PyLucid/install/tests.py
r1302 r1510 4 4 """ 5 5 6 import os, cgi, sys, time 7 8 from django.conf import settings 9 10 from django import newforms as forms 11 from django.core import management 12 from django.core.cache import cache 13 6 14 from PyLucid.install.BaseInstall import BaseInstall 7 15 from PyLucid.system.response import SimpleStringIO 8 9 from django.core import management10 from django import newforms as forms11 12 import os, cgi, sys, time13 16 14 17 … … 22 25 print txt 23 26 print "-"*80 27 28 def _test_cache(self): 29 """ 30 Test the cache backend. 31 """ 32 if settings.CACHE_BACKEND.startswith("dummy"): 33 return 34 self._print_infoline( 35 "Test cache backend '%s':" % settings.CACHE_BACKEND 36 ) 37 cache_key = "cache test" 38 content = "A cache test content..." 39 cache_timeout = 50 40 print "Save into cache with key '%s'." % cache_key 41 cache.set(cache_key, content, cache_timeout) 42 print "Try to get the saved content from the cache." 43 cached_content = cache.get(cache_key) 44 if cached_content == None: 45 print " * Get None back. Cache didn't work!" 46 return 47 elif cached_content==content: 48 print " * Cache works fine ;)" 49 else: 50 # Should never appears 51 print " * Error! Cache content not the same!" 52 53 print "Try to delete the cache entry." 54 cache.delete(cache_key) 55 cached_content = cache.get(cache_key) 56 if cached_content == None: 57 print "OK, entry deleted." 58 else: 59 print "Error: entry not deleted!" 60 24 61 25 62 def _verbose_try_import(self, module_name): … … 109 146 110 147 def print_info(self): 148 self._test_cache() 149 111 150 self._print_infoline("Tests for the memcache backend:") 112 151 self._verbose_try_import("cmemcache")