comparison test/session_common.py @ 7879:39c482e6a246

fix: fix code to make tests of session and otks databases pass on windows The existing code had a few issues: sessions_dbm.py: detect dumbdbm when used on windows python and properly delete session/otks databases so clear() works. make sure the Session/Otks.cache_db_type() is called even when the database is newly created. test/session_common.py: close session and otks database in teardown before deleting database directory to prevent errors from deleting open files on windows. test/test_sqlite.py: close the session and otks databases opened by SessionTest.setUp(self) so the salite session/otks database are closed before the new anydbm sessions databases are opened for testing the sqlite main db and anydbm as session/otks db. Again this causes deletion of database test directory to fail on windows as you can't delete open files.
author John Rouillard <rouilj@ieee.org>
date Thu, 18 Apr 2024 17:39:56 -0400
parents fe0091279f50
children 9347c4a0ecd6
comparison
equal deleted inserted replaced
7878:d4aef2b004a1 7879:39c482e6a246
47 self.otks = self.db.getOTKManager() 47 self.otks = self.db.getOTKManager()
48 48
49 def tearDown(self): 49 def tearDown(self):
50 if hasattr(self, 'db'): 50 if hasattr(self, 'db'):
51 self.db.close() 51 self.db.close()
52 if hasattr(self, 'sessions'):
53 self.sessions.close()
54 if hasattr(self, 'otks'):
55 self.otks.close()
52 if os.path.exists(config.DATABASE): 56 if os.path.exists(config.DATABASE):
53 shutil.rmtree(config.DATABASE) 57 shutil.rmtree(config.DATABASE)
54 58
55 def testList(self): 59 def testList(self):
56 '''Under dbm/memory sessions store, keys are returned as 60 '''Under dbm/memory sessions store, keys are returned as

Roundup Issue Tracker: http://roundup-tracker.org/