diff options
| author | Jesus Cea <jcea@jcea.es> | 2008-08-31 14:00:51 (GMT) |
|---|---|---|
| committer | Jesus Cea <jcea@jcea.es> | 2008-08-31 14:00:51 (GMT) |
| commit | 4907d27c1fcc7bd990715d3023932433076e152f (patch) | |
| tree | f7e79e00d3e95785b6ff3d2d0b809e6d6e5e5779 /Lib/bsddb/test/test_distributed_transactions.py | |
| parent | 82358691f77e33301df2916746474873b35ccafa (diff) | |
| download | cpython-4907d27c1fcc7bd990715d3023932433076e152f.zip cpython-4907d27c1fcc7bd990715d3023932433076e152f.tar.gz cpython-4907d27c1fcc7bd990715d3023932433076e152f.tar.bz2 | |
Update bsddb code to version 4.7.3pre2. This code should
be compatible with Python 3.0, also.
http://www.jcea.es/programacion/pybsddb.htm#bsddb3-4.7.3
Diffstat (limited to 'Lib/bsddb/test/test_distributed_transactions.py')
| -rw-r--r-- | Lib/bsddb/test/test_distributed_transactions.py | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/Lib/bsddb/test/test_distributed_transactions.py b/Lib/bsddb/test/test_distributed_transactions.py index 82f36e9..f864b88 100644 --- a/Lib/bsddb/test/test_distributed_transactions.py +++ b/Lib/bsddb/test/test_distributed_transactions.py @@ -4,19 +4,8 @@ import os import unittest -try: - # For Pythons w/distutils pybsddb - from bsddb3 import db -except ImportError: - # For Python 2.3 - from bsddb import db - -from test_all import get_new_environment_path, get_new_database_path - -try: - from bsddb3 import test_support -except ImportError: - from test import test_support +from test_all import db, test_support, get_new_environment_path, \ + get_new_database_path try : a=set() @@ -79,12 +68,16 @@ class DBTxn_distributed(unittest.TestCase): def test01_distributed_transactions(self) : txns=set() + adapt = lambda x : x + import sys + if sys.version_info[0] >= 3 : + adapt = lambda x : bytes(x, "ascii") # Create transactions, "prepare" them, and # let them be garbage collected. for i in xrange(self.num_txns) : - txn=self.dbenv.txn_begin() - gid="%%%dd" %db.DB_XIDDATASIZE - gid=gid %i + txn = self.dbenv.txn_begin() + gid = "%%%dd" %db.DB_XIDDATASIZE + gid = adapt(gid %i) self.db.put(i, gid, txn=txn, flags=db.DB_APPEND) txns.add(gid) txn.prepare(gid) |
