Commit Graph

120 Commits

Author SHA1 Message Date
Neal Norwitz 31e88934ed Remove the files/dirs after closing the DB so the tests work on Windows.
Patch from Trent Nelson.  Also simplified removing a file by using test_support.
2008-03-05 05:10:48 +00:00
Neal Norwitz 4a50d26ba2 Close the file before trying to remove the directory so it works on Windows.
As reported by Trent Nelson on python-dev.
2008-03-04 16:22:46 +00:00
Gregory P. Smith 492e2bfefa Modify import of test_support so that the code can also be used with a
stand alone distribution of bsddb that includes its own small copy of
test_support for the needed functionality on older pythons.
2008-03-02 20:00:53 +00:00
Neal Norwitz 6057b2e645 Create a db_home directory with a unique name so multiple users can
run the test simultaneously.  The simplest thing I found that worked
on both Windows and Unix was to use the PID.  It's unique so should be
sufficient.  This should prevent many of the spurious failures of
the automated tests since they run as different users.

Also cleanup the directory consistenly in the tearDown methods.

It would be nice if someone ensured that the directories are always
created with a consistent name.
2008-02-24 18:47:03 +00:00
Christian Heimes c5f05e45cf Patch #2167 from calvin: Remove unused imports 2008-02-23 17:40:11 +00:00
Neal Norwitz 3d785e2c6a Consistently use tempfile.tempdir for the db_home directory. 2008-01-26 23:14:17 +00:00
Neal Norwitz 960efe9c2d Fix exception in tearDown on ppc buildbot. If there's no directory,
that shouldn't cause the test to fail.  Just like it setUp.
2008-01-26 07:38:03 +00:00
Gregory P. Smith 80e95c142e * db->get_flags is only available in BerkeleyDB >= 4.2 2007-11-05 09:07:40 +00:00
Gregory P. Smith ac11e02143 Add the bsddb.db.DBEnv.lock_id_free method.
Improve test_lock's tempdir creation and cleanup.
2007-11-05 02:56:31 +00:00
Gregory P. Smith ec10a4a402 Fixes bug 477182 on pybsddb.sf.net. DB objects now load the flags and
pay attention to them when opening an existing database.  This means
that d[] behaves properly even on databases previously created with DB_DUP
or DB_DUPSORT flags to allow duplicate keys.

http://sourceforge.net/tracker/index.php?func=detail&aid=477182&group_id=13900&atid=113900

Do not backport, this bugfix could be considered an API change.
2007-11-05 02:32:26 +00:00
Gregory P. Smith 6d331ca9a4 Undo revision 58533 58534 fixes. Those were a workaround for
a problem introduced by 58385.
2007-11-01 21:15:36 +00:00
Gregory P. Smith aae141a751 Fix bug introduced in revision 58385. Database keys could no longer
have NULL bytes in them.  Replace the errant strdup with a
malloc+memcpy.  Adds a unit test for the correct behavior.
2007-11-01 21:08:14 +00:00
Gregory P. Smith 87fc9ad966 squelch the warning that this test is supposed to trigger. 2007-10-19 07:31:20 +00:00
Gregory P. Smith 3ef21cb7c6 A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
2007-10-18 16:32:02 +00:00
Gregory P. Smith f8a2a0b5a9 Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
2007-10-18 08:34:20 +00:00
Gregory P. Smith afed3a4552 cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion.  (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
2007-10-18 07:56:54 +00:00
Neal Norwitz d29f1d2241 Use unittest for assertions 2007-10-14 18:40:37 +00:00
Neal Norwitz 3884690d69 Don't raise a string exception, they don't work anymore. 2007-10-14 18:30:21 +00:00
Gregory P. Smith 5d743fd187 Fix an uncollectable reference leak in bsddb.db.DBShelf.append 2007-10-13 23:02:05 +00:00
Gregory P. Smith d40f126fff Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic.  Also adds a test case for RECNO dbs
to test_dbshelve.
2007-10-12 18:44:06 +00:00
Gregory P. Smith b7de61bf49 Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
2007-10-09 07:19:11 +00:00
Gregory P. Smith 10bed54ae2 Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
2007-10-09 06:50:43 +00:00
Gregory P. Smith f80578548d email address update 2007-09-09 20:25:00 +00:00
Gregory P. Smith 161586c804 Apply the fix from Issue1112 to make this test more robust and keep
windows happy.
2007-09-06 22:59:59 +00:00
Gregory P. Smith 1042a4d719 Fix bug 1725856. 2007-08-24 05:11:38 +00:00
Gregory P. Smith ca4669c152 stop leaving log.0000001 __db.00* and xxx.db turds in developer
sandboxes when bsddb3 tests are run.
2007-08-22 21:32:34 +00:00
Neal Norwitz d410b320ec Give some clue as to what happened if the test fails. 2007-05-19 04:35:52 +00:00
Andrew M. Kuchling 9c3a392321 [Patch #1520904] Fix bsddb tests to write to the temp directory instead of the Lib/bsddb/test directory 2007-01-05 15:51:24 +00:00
Gregory P. Smith 8b96a35d14 Support linking of the bsddb module against BerkeleyDB 4.5.x
(will backport to 2.5)
2007-01-05 01:59:42 +00:00
Neal Norwitz 10cdb7492e Oops, convert tabs to spaces 2006-11-21 05:51:51 +00:00
Neal Norwitz 4fe442383d Bug #1599782: Fix segfault on bsddb.db.DB().type().
The problem is that _DB_get_type() can't be called without the GIL
because it calls a bunch of PyErr_* APIs when an error occurs.
There were no other cases in this file that it was called without the GIL.
Removing the BEGIN/END THREAD around _DB_get_type() made everything work.

Will backport.
2006-11-21 05:26:22 +00:00
Neal Norwitz 919d5cc163 This was found by Guido AFAIK on p3yk (sic) branch. 2006-09-05 02:35:08 +00:00
Gregory P. Smith 641cddf0fa - 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.
2006-07-28 01:35:25 +00:00
Gregory P. Smith 506f7b559a - bsddb: multithreaded DB access using the simple bsddb module interface
now works reliably.  It has been updated to use automatic BerkeleyDB
  deadlock detection and the bsddb.dbutils.DeadlockWrap wrapper to retry
  database calls that would previously deadlock. [SF python bug #775414]
2006-06-15 08:52:32 +00:00
Neal Norwitz 6aaccc6b55 Fix errors found by pychecker 2006-06-11 08:35:14 +00:00
Gregory P. Smith 996710fd44 pasted set_lk_detect line in wrong spot in previous commit. fixed. passes tests this time. 2006-06-08 05:39:54 +00:00
Gregory P. Smith dda291c079 * Turn the deadlock situation described in SF bug #775414 into a
DBDeadLockError exception.
* add the test case for my previous dbtables commit.
2006-06-08 05:38:11 +00:00
Gregory P. Smith ff7d991a07 - bsddb: the bsddb.dbtables Modify method now raises the proper error and
aborts the db transaction safely when a modifier callback fails.
  Fixes SF python patch/bug #1408584.

Also cleans up the bsddb.dbtables docstrings since thats the only
documentation that exists for that unadvertised module.  (people
really should really just use sqlite3)
2006-06-08 05:17:08 +00:00
Tim Peters c169e9f19c Add missing svn:eol-style property to text files. 2006-06-05 20:49:27 +00:00
Gregory P. Smith 372b583a6b * fix DBCursor.pget() bug with keyword argument names when no data= is
supplied [SF pybsddb bug #1477863]
2006-06-05 18:48:21 +00:00
Tim Peters d6024d30c6 Whitespace normalization. 2006-06-05 18:36:12 +00:00
Gregory P. Smith 9d7a69caa9 forgot to add this file in previous commit 2006-06-05 18:20:07 +00:00
Gregory P. Smith f0547d0d3e * add support for DBSequence objects [patch #1466734] 2006-06-05 17:38:04 +00:00
Gregory P. Smith db8a80735b * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902] 2006-06-05 01:56:15 +00:00
Tim Peters 7140de01cf Whitespace normalization. 2006-06-05 01:47:24 +00:00
Gregory P. Smith 76a82e89ab * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885] 2006-06-05 01:39:52 +00:00
Gregory P. Smith 3dd20022ac bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present
in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized
char **log_list.

feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2.
2006-06-05 00:31:01 +00:00
Tim Peters 0ebf27aad9 BaseThreadedTestCase.setup(): stop special-casing WindowsError.
Rev 45964 fiddled with WindowsError, and broke test_bsddb3 on all
the Windows buildbot slaves as a result.  This should repair it.
2006-05-11 16:37:42 +00:00
Martin v. Löwis e93abb7ca6 Handle ERROR_ALREADY_EXISTS. 2006-05-06 20:04:08 +00:00
Gregory P. Smith 64029986bc Fixes bug #1117761
bsddb.*open() methods cachesize parameter wouldn't work (raised an
internal bsddb.db exception when it was given).  The set_cachesize
call needed to be moved from the DB object to the DBEnv since the env
was introduced to allow for threading.

(will backport to 2.4)
2006-04-12 20:35:02 +00:00