Commits

Robert Brewer committed 042fb7c

Fix for #765 (Intermittent failure in 3.0.x session test).

  • Participants
  • Parent commits e11b280
  • Branches cherrypy-3.0.x
  • Tags cherrypy-3.0.3, cherrypy-3.0.x

Comments (0)

Files changed (1)

File cherrypy/test/test_session.py

         _cp_config = {'tools.sessions.on': True,
                       'tools.sessions.storage_type' : 'ram',
                       'tools.sessions.storage_path' : localDir,
-                      'tools.sessions.timeout': 0.017,    # 1.02 secs
-                      'tools.sessions.clean_freq': 0.017,
+                      'tools.sessions.timeout': (1.0 / 60),
+                      'tools.sessions.clean_freq': (1.0 / 60),
                       }
         
         def testGen(self):
 
 class SessionTest(helper.CPWebCase):
     
+    def tearDown(self):
+        # Clean up sessions.
+        for fname in os.listdir(localDir):
+            if fname.startswith(sessions.FileSession.SESSION_PREFIX):
+                os.unlink(os.path.join(localDir, fname))
+    
     def test_0_Session(self):
         self.getPage('/testStr')
         self.assertBody('1')
         self.getPage('/delkey?key=counter', self.cookies)
         self.assertStatus(200)
         
-        # Wait for the session.timeout (1.02 secs)
-        time.sleep(1.25)
+        # Wait for the session.timeout (1 second)
+        time.sleep(2)
         self.getPage('/')
         self.assertBody('1')