Commits

Robert Brewer committed 042fb7c

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

Comments (0)

Files changed (1)

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')
         
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.