diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2006-07-28 01:35:25 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2006-07-28 01:35:25 (GMT) |
commit | 641cddf0faa2aa50935e8f963094d9a0d7857adb (patch) | |
tree | 9e1ad95d8674d8dc46aa7df25a17a0be98bc0923 /Lib/bsddb/test | |
parent | 9cab593c0e640dbeaeb774726b964cf2690cbf7a (diff) | |
download | cpython-641cddf0faa2aa50935e8f963094d9a0d7857adb.zip cpython-641cddf0faa2aa50935e8f963094d9a0d7857adb.tar.gz cpython-641cddf0faa2aa50935e8f963094d9a0d7857adb.tar.bz2 |
- pybsddb Bug #1527939: bsddb module DBEnv dbremove and dbrename
methods now allow their database parameter to be None as the
sleepycat API allows.
Also adds an appropriate test case for DBEnv.dbrename and dbremove.
Diffstat (limited to 'Lib/bsddb/test')
-rw-r--r-- | Lib/bsddb/test/test_basics.py | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py index 0ae8732..25e0b6b 100644 --- a/Lib/bsddb/test/test_basics.py +++ b/Lib/bsddb/test/test_basics.py @@ -562,6 +562,9 @@ class BasicTestCase(unittest.TestCase): num = d.truncate() assert num == 0, "truncate on empty DB returned nonzero (%r)" % (num,) + #---------------------------------------- + + #---------------------------------------------------------------------- @@ -583,18 +586,40 @@ class BasicHashWithThreadFlagTestCase(BasicTestCase): dbopenflags = db.DB_THREAD -class BasicBTreeWithEnvTestCase(BasicTestCase): - dbtype = db.DB_BTREE +class BasicWithEnvTestCase(BasicTestCase): dbopenflags = db.DB_THREAD useEnv = 1 envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK + #---------------------------------------- + + def test07_EnvRemoveAndRename(self): + if not self.env: + return + + if verbose: + print '\n', '-=' * 30 + print "Running %s.test07_EnvRemoveAndRename..." % self.__class__.__name__ + + # can't rename or remove an open DB + self.d.close() + + newname = self.filename + '.renamed' + self.env.dbrename(self.filename, None, newname) + self.env.dbremove(newname) + + # dbremove and dbrename are in 4.1 and later + if db.version() < (4,1): + del test07_EnvRemoveAndRename -class BasicHashWithEnvTestCase(BasicTestCase): + #---------------------------------------- + +class BasicBTreeWithEnvTestCase(BasicWithEnvTestCase): + dbtype = db.DB_BTREE + + +class BasicHashWithEnvTestCase(BasicWithEnvTestCase): dbtype = db.DB_HASH - dbopenflags = db.DB_THREAD - useEnv = 1 - envflags = db.DB_THREAD | db.DB_INIT_MPOOL | db.DB_INIT_LOCK #---------------------------------------------------------------------- |