Changeset 442
- Timestamp:
- 07/09/05 21:26:14
- Files:
-
- trunk/cherrypy/test/test_session_filter.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/test/test_session_filter.py
r431 r442 34 34 from cherrypy.test import helper 35 35 36 localDir = os.path.dirname(__file__) 37 curpath = os.path.normpath(os.path.join(os.getcwd(), localDir)) 38 tmpFolder = os.path.join(curpath, 'tmpSessionTestData') 39 36 40 server_conf = { 37 41 'global' : … … 39 43 'server.socketHost': helper.HOST, 40 44 'server.socketPort': helper.PORT, 41 'server.threadPool': 1 0,45 'server.threadPool': 1, 42 46 'server.logToScreen': False, 43 47 'server.environment': "production", 44 48 'sessionFilter.on' : True, 45 'sessionFilter. default.on' : False,46 'sessionFilter.storagePath' : 'tmpSessionTestData'49 'sessionFilter.cacheTimeout' : 60, 50 'sessionFilter.storagePath' : tmpFolder 47 51 }, 48 52 '/ram' : { 'sessionFilter.ram.on' : True, 'sessionFilter.ram.storageType' : 'ram' }, … … 77 81 cherrypy.config.update(server_conf.copy()) 78 82 79 class TutorialTest(unittest.TestCase): 83 import threading 80 84 81 persistantCookies = {} 85 class SessionFilterTest(unittest.TestCase): 82 86 83 def __testStorageType(self, storageType, startCount = 1, iterations = 0): 84 87 persistantCookies = [] 88 89 def __testStorageType(self, storageType, startCount = 1, iterations = 4): 85 90 #cherrypy.config.update({"sessionFilter.storageType": storageType}) 86 91 … … 103 108 def testAnydbSessions(self): 104 109 self.__testStorageType('anydb') 105 110 111 def testThreadSafety(self, storageType = 'ram'): 112 for z in range(3): 113 try: 114 threading.Thread(target = self.__testStorageType, args = ('ram', 1, 4)).start() 115 except: 116 pass 117 106 118 ''' 107 119 def testSqlObjectSession(self): 108 120 self.__testStorageType('sqlobject') 109 121 ''' 110 122 111 123 if __name__ == "__main__": 112 124 try: 113 os.mkdir('tmpSessionTestData') 114 for file in os.listdir('tmpSessionTestData'): 115 os.unlink(os.path.join('tmpSessionTestData', file)) 125 os.mkdir(tmpFolder) 116 126 except OSError: 117 127 pass 128 118 129 cherrypy.server.start(initOnly=True) 119 unittest.main() 130 try: 131 unittest.main() 132 except SystemExit: 133 pass 134 #shutil.rmtree(tmpFolder) 135 #os.rmdir(tmpFolder)

