Kaydet (Commit) 492e2bfe authored tarafından Gregory P. Smith's avatar Gregory P. Smith

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.
üst e6dab2a0
...@@ -23,6 +23,11 @@ except ImportError: ...@@ -23,6 +23,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db, dbshelve from bsddb import db, dbshelve
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
#---------------------------------------------------------------------- #----------------------------------------------------------------------
...@@ -106,7 +111,6 @@ class AssociateErrorTestCase(unittest.TestCase): ...@@ -106,7 +111,6 @@ class AssociateErrorTestCase(unittest.TestCase):
def tearDown(self): def tearDown(self):
self.env.close() self.env.close()
self.env = None self.env = None
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
def test00_associateDBError(self): def test00_associateDBError(self):
......
...@@ -8,7 +8,6 @@ import errno ...@@ -8,7 +8,6 @@ import errno
import string import string
import tempfile import tempfile
from pprint import pprint from pprint import pprint
from test import test_support
import unittest import unittest
import time import time
...@@ -19,6 +18,11 @@ except ImportError: ...@@ -19,6 +18,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db from bsddb import db
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
from test_all import verbose from test_all import verbose
DASH = '-' DASH = '-'
......
...@@ -15,6 +15,11 @@ except ImportError: ...@@ -15,6 +15,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db, dbshelve from bsddb import db, dbshelve
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
lexical_cmp = cmp lexical_cmp = cmp
def lowercase_cmp(left, right): def lowercase_cmp(left, right):
...@@ -70,7 +75,6 @@ class AbstractBtreeKeyCompareTestCase (unittest.TestCase): ...@@ -70,7 +75,6 @@ class AbstractBtreeKeyCompareTestCase (unittest.TestCase):
if self.env is not None: if self.env is not None:
self.env.close () self.env.close ()
self.env = None self.env = None
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
def addDataToDB (self, data): def addDataToDB (self, data):
......
...@@ -9,6 +9,11 @@ except ImportError: ...@@ -9,6 +9,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db from bsddb import db
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
#---------------------------------------------------------------------- #----------------------------------------------------------------------
...@@ -42,7 +47,6 @@ class pget_bugTestCase(unittest.TestCase): ...@@ -42,7 +47,6 @@ class pget_bugTestCase(unittest.TestCase):
del self.secondary_db del self.secondary_db
del self.primary_db del self.primary_db
del self.env del self.env
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
def test_pget(self): def test_pget(self):
......
...@@ -10,6 +10,11 @@ except ImportError: ...@@ -10,6 +10,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db, dbobj from bsddb import db, dbobj
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
#---------------------------------------------------------------------- #----------------------------------------------------------------------
...@@ -29,7 +34,6 @@ class dbobjTestCase(unittest.TestCase): ...@@ -29,7 +34,6 @@ class dbobjTestCase(unittest.TestCase):
del self.db del self.db
if hasattr(self, 'env'): if hasattr(self, 'env'):
del self.env del self.env
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
def test01_both(self): def test01_both(self):
......
...@@ -14,6 +14,11 @@ except ImportError: ...@@ -14,6 +14,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db, dbshelve from bsddb import db, dbshelve
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
from test_all import verbose from test_all import verbose
...@@ -262,7 +267,6 @@ class BasicEnvShelveTestCase(DBShelveTestCase): ...@@ -262,7 +267,6 @@ class BasicEnvShelveTestCase(DBShelveTestCase):
def tearDown(self): def tearDown(self):
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
self.do_close() self.do_close()
......
...@@ -39,6 +39,10 @@ except ImportError: ...@@ -39,6 +39,10 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db, dbtables from bsddb import db, dbtables
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
#---------------------------------------------------------------------- #----------------------------------------------------------------------
...@@ -57,7 +61,6 @@ class TableDBTestCase(unittest.TestCase): ...@@ -57,7 +61,6 @@ class TableDBTestCase(unittest.TestCase):
def tearDown(self): def tearDown(self):
self.tdb.close() self.tdb.close()
from test import test_support
test_support.rmtree(self.testHomeDir) test_support.rmtree(self.testHomeDir)
def test01(self): def test01(self):
......
...@@ -13,6 +13,11 @@ except ImportError: ...@@ -13,6 +13,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db from bsddb import db
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
from test_all import verbose from test_all import verbose
# We're going to get warnings in this module about trying to close the db when # We're going to get warnings in this module about trying to close the db when
...@@ -39,7 +44,6 @@ class DBEnvClosedEarlyCrash(unittest.TestCase): ...@@ -39,7 +44,6 @@ class DBEnvClosedEarlyCrash(unittest.TestCase):
tempfile.tempdir = None tempfile.tempdir = None
def tearDown(self): def tearDown(self):
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
def test01_close_dbenv_before_db(self): def test01_close_dbenv_before_db(self):
......
...@@ -20,6 +20,10 @@ except ImportError: ...@@ -20,6 +20,10 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db, dbshelve from bsddb import db, dbshelve
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
#---------------------------------------------------------------------- #----------------------------------------------------------------------
...@@ -56,7 +60,6 @@ class JoinTestCase(unittest.TestCase): ...@@ -56,7 +60,6 @@ class JoinTestCase(unittest.TestCase):
def tearDown(self): def tearDown(self):
self.env.close() self.env.close()
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
def test01_join(self): def test01_join(self):
......
...@@ -22,6 +22,11 @@ except ImportError: ...@@ -22,6 +22,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db from bsddb import db
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
#---------------------------------------------------------------------- #----------------------------------------------------------------------
...@@ -36,7 +41,6 @@ class LockingTestCase(unittest.TestCase): ...@@ -36,7 +41,6 @@ class LockingTestCase(unittest.TestCase):
def tearDown(self): def tearDown(self):
self.env.close() self.env.close()
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
......
...@@ -12,6 +12,11 @@ except ImportError: ...@@ -12,6 +12,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db, dbshelve, hashopen from bsddb import db, dbshelve, hashopen
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
#---------------------------------------------------------------------- #----------------------------------------------------------------------
class MiscTestCase(unittest.TestCase): class MiscTestCase(unittest.TestCase):
...@@ -25,7 +30,6 @@ class MiscTestCase(unittest.TestCase): ...@@ -25,7 +30,6 @@ class MiscTestCase(unittest.TestCase):
pass pass
def tearDown(self): def tearDown(self):
from test import test_support
test_support.unlink(self.filename) test_support.unlink(self.filename)
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
......
...@@ -15,6 +15,11 @@ except ImportError, e: ...@@ -15,6 +15,11 @@ except ImportError, e:
# For Python 2.3 # For Python 2.3
from bsddb import db from bsddb import db
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
#---------------------------------------------------------------------- #----------------------------------------------------------------------
...@@ -34,7 +39,6 @@ class pickleTestCase(unittest.TestCase): ...@@ -34,7 +39,6 @@ class pickleTestCase(unittest.TestCase):
del self.db del self.db
if hasattr(self, 'env'): if hasattr(self, 'env'):
del self.env del self.env
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
def _base_test_pickle_DBError(self, pickle): def _base_test_pickle_DBError(self, pickle):
......
...@@ -16,6 +16,11 @@ except ImportError: ...@@ -16,6 +16,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db from bsddb import db
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
...@@ -27,7 +32,6 @@ class SimpleRecnoTestCase(unittest.TestCase): ...@@ -27,7 +32,6 @@ class SimpleRecnoTestCase(unittest.TestCase):
self.homeDir = None self.homeDir = None
def tearDown(self): def tearDown(self):
from test import test_support
test_support.unlink(self.filename) test_support.unlink(self.filename)
if self.homeDir: if self.homeDir:
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
......
...@@ -8,6 +8,11 @@ try: ...@@ -8,6 +8,11 @@ try:
except ImportError: except ImportError:
from bsddb import db from bsddb import db
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
class DBSequenceTest(unittest.TestCase): class DBSequenceTest(unittest.TestCase):
def setUp(self): def setUp(self):
...@@ -37,7 +42,6 @@ class DBSequenceTest(unittest.TestCase): ...@@ -37,7 +42,6 @@ class DBSequenceTest(unittest.TestCase):
self.dbenv.close() self.dbenv.close()
del self.dbenv del self.dbenv
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
def test_get(self): def test_get(self):
......
...@@ -38,6 +38,11 @@ except ImportError: ...@@ -38,6 +38,11 @@ except ImportError:
# For Python 2.3 # For Python 2.3
from bsddb import db, dbutils from bsddb import db, dbutils
try:
from bsddb3 import test_support
except ImportError:
from test import test_support
#---------------------------------------------------------------------- #----------------------------------------------------------------------
...@@ -68,7 +73,6 @@ class BaseThreadedTestCase(unittest.TestCase): ...@@ -68,7 +73,6 @@ class BaseThreadedTestCase(unittest.TestCase):
self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE) self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE)
def tearDown(self): def tearDown(self):
from test import test_support
test_support.rmtree(self.homeDir) test_support.rmtree(self.homeDir)
self.d.close() self.d.close()
self.env.close() self.env.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment