]> granicus.if.org Git - python/commitdiff
Modify import of test_support so that the code can also be used with a
authorGregory P. Smith <greg@mad-scientist.com>
Sun, 2 Mar 2008 20:00:53 +0000 (20:00 +0000)
committerGregory P. Smith <greg@mad-scientist.com>
Sun, 2 Mar 2008 20:00:53 +0000 (20:00 +0000)
stand alone distribution of bsddb that includes its own small copy of
test_support for the needed functionality on older pythons.

15 files changed:
Lib/bsddb/test/test_associate.py
Lib/bsddb/test/test_basics.py
Lib/bsddb/test/test_compare.py
Lib/bsddb/test/test_cursor_pget_bug.py
Lib/bsddb/test/test_dbobj.py
Lib/bsddb/test/test_dbshelve.py
Lib/bsddb/test/test_dbtables.py
Lib/bsddb/test/test_env_close.py
Lib/bsddb/test/test_join.py
Lib/bsddb/test/test_lock.py
Lib/bsddb/test/test_misc.py
Lib/bsddb/test/test_pickle.py
Lib/bsddb/test/test_recno.py
Lib/bsddb/test/test_sequence.py
Lib/bsddb/test/test_thread.py

index 88c1f460ca44007d195d1fe973d0d0e98e60df5f..80b1a8ea8cc0034e3b736f4403e69b7252170c41 100644 (file)
@@ -23,6 +23,11 @@ except ImportError:
     # For Python 2.3
     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):
     def tearDown(self):
         self.env.close()
         self.env = None
-        from test import test_support
         test_support.rmtree(self.homeDir)
 
     def test00_associateDBError(self):
index af82cd1b6e5d48d242670002adc924b8eb2eff89..f0b5e32ed31ee2cca08a46d17b3c498ade38b462 100644 (file)
@@ -8,7 +8,6 @@ import errno
 import string
 import tempfile
 from pprint import pprint
-from test import test_support
 import unittest
 import time
 
@@ -19,6 +18,11 @@ except ImportError:
     # For Python 2.3
     from bsddb import db
 
+try:
+    from bsddb3 import test_support
+except ImportError:
+    from test import test_support
+
 from test_all import verbose
 
 DASH = '-'
index 2782e8ccc33aa2eb2f7ad4fcaa345838fa02f70a..ac9ee6bbf14a20cfd54afa0f568e95973152ce71 100644 (file)
@@ -15,6 +15,11 @@ except ImportError:
     # For Python 2.3
     from bsddb import db, dbshelve
 
+try:
+    from bsddb3 import test_support
+except ImportError:
+    from test import test_support
+
 lexical_cmp = cmp
 
 def lowercase_cmp(left, right):
@@ -70,7 +75,6 @@ class AbstractBtreeKeyCompareTestCase (unittest.TestCase):
         if self.env is not None:
             self.env.close ()
             self.env = None
-        from test import test_support
         test_support.rmtree(self.homeDir)
 
     def addDataToDB (self, data):
index 95bbe1be1ca087a9400f6cf75e352ce56f91e1b3..486856218716a671978a772ce48f8c53cf170aff 100644 (file)
@@ -9,6 +9,11 @@ except ImportError:
     # For Python 2.3
     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):
         del self.secondary_db
         del self.primary_db
         del self.env
-        from test import test_support
         test_support.rmtree(self.homeDir)
 
     def test_pget(self):
index 071b54724a24989c58156c5e1089a8f529d81b3f..c15facea347c52af8042a22a966ae1355183cedd 100644 (file)
@@ -10,6 +10,11 @@ except ImportError:
     # For Python 2.3
     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):
             del self.db
         if hasattr(self, 'env'):
             del self.env
-        from test import test_support
         test_support.rmtree(self.homeDir)
 
     def test01_both(self):
index d6c997fd205f283d4072e24b33286e6b8f809311..21070856bda70a0a9be400587a5a2e34f4a5a84e 100644 (file)
@@ -14,6 +14,11 @@ except ImportError:
     # For Python 2.3
     from bsddb import db, dbshelve
 
+try:
+    from bsddb3 import test_support
+except ImportError:
+    from test import test_support
+
 from test_all import verbose
 
 
@@ -262,7 +267,6 @@ class BasicEnvShelveTestCase(DBShelveTestCase):
 
 
     def tearDown(self):
-        from test import test_support
         test_support.rmtree(self.homeDir)
         self.do_close()
 
index 7acfdd12ed1168ba2f1269cc777ede2a8c751040..46602cecd3f151843783c5c5a5e182261c6cd3e2 100644 (file)
@@ -39,6 +39,10 @@ except ImportError:
     # For Python 2.3
     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):
 
     def tearDown(self):
         self.tdb.close()
-        from test import test_support
         test_support.rmtree(self.testHomeDir)
 
     def test01(self):
index 409f3dc5c0f3e1baa7953582ddfa7fc66747007c..e07e472a16b094842086f6aea9dea0a7a8941d5e 100644 (file)
@@ -13,6 +13,11 @@ except ImportError:
     # For Python 2.3
     from bsddb import db
 
+try:
+    from bsddb3 import test_support
+except ImportError:
+    from test import test_support
+
 from test_all import verbose
 
 # We're going to get warnings in this module about trying to close the db when
@@ -39,7 +44,6 @@ class DBEnvClosedEarlyCrash(unittest.TestCase):
         tempfile.tempdir = None
 
     def tearDown(self):
-        from test import test_support
         test_support.rmtree(self.homeDir)
 
     def test01_close_dbenv_before_db(self):
index f9e7f00b381bc93f93839da393522197fcf71ede..c6c5c883f6d8e15308449238be9c74d721985f53 100644 (file)
@@ -20,6 +20,10 @@ except ImportError:
     # For Python 2.3
     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):
 
     def tearDown(self):
         self.env.close()
-        from test import test_support
         test_support.rmtree(self.homeDir)
 
     def test01_join(self):
index 28620799c8a07253e481669c8d9a0fb3f4ac19ea..3b2f9e46cadf0c95ecc57abed8c74d8234cd074c 100644 (file)
@@ -22,6 +22,11 @@ except ImportError:
     # For Python 2.3
     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):
 
     def tearDown(self):
         self.env.close()
-        from test import test_support
         test_support.rmtree(self.homeDir)
 
 
index a9228f9c7200d00f94d33f85c389dc284ef5eb54..9a790e7181b46ba3fee458401fcb9fb44e6607d9 100644 (file)
@@ -12,6 +12,11 @@ except ImportError:
     # For Python 2.3
     from bsddb import db, dbshelve, hashopen
 
+try:
+    from bsddb3 import test_support
+except ImportError:
+    from test import test_support
+
 #----------------------------------------------------------------------
 
 class MiscTestCase(unittest.TestCase):
@@ -25,7 +30,6 @@ class MiscTestCase(unittest.TestCase):
             pass
 
     def tearDown(self):
-        from test import test_support
         test_support.unlink(self.filename)
         test_support.rmtree(self.homeDir)
 
index 10ce6850c603d5a5fb0598943db54afa02d0fdcc..d691e3714cbc1acf10d54dce422047f535770d15 100644 (file)
@@ -15,6 +15,11 @@ except ImportError, e:
     # For Python 2.3
     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):
             del self.db
         if hasattr(self, 'env'):
             del self.env
-        from test import test_support
         test_support.rmtree(self.homeDir)
 
     def _base_test_pickle_DBError(self, pickle):
index 1074a76284c2bb32cfda5483095d5988bed306ec..43cf176cd9e184acad5c0f354e64692411fac19a 100644 (file)
@@ -16,6 +16,11 @@ except ImportError:
     # For Python 2.3
     from bsddb import db
 
+try:
+    from bsddb3 import test_support
+except ImportError:
+    from test import test_support
+
 letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
 
@@ -27,7 +32,6 @@ class SimpleRecnoTestCase(unittest.TestCase):
         self.homeDir = None
 
     def tearDown(self):
-        from test import test_support
         test_support.unlink(self.filename)
         if self.homeDir:
             test_support.rmtree(self.homeDir)
index 86c58b0c05d3326aa4f87ebe4fbb93f36ea17dfe..ff94b7663adb3423f85501a302186141b69bcf79 100644 (file)
@@ -8,6 +8,11 @@ try:
 except ImportError:
     from bsddb import db
 
+try:
+    from bsddb3 import test_support
+except ImportError:
+    from test import test_support
+
 
 class DBSequenceTest(unittest.TestCase):
     def setUp(self):
@@ -37,7 +42,6 @@ class DBSequenceTest(unittest.TestCase):
             self.dbenv.close()
             del self.dbenv
 
-        from test import test_support
         test_support.rmtree(self.homeDir)
 
     def test_get(self):
index 8a8b313762de2ba1763c6ccc847fd0d62388a33c..15ed9056dc607af820a6a7560682f455a9b1ab49 100644 (file)
@@ -38,6 +38,11 @@ except ImportError:
     # For Python 2.3
     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):
         self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE)
 
     def tearDown(self):
-        from test import test_support
         test_support.rmtree(self.homeDir)
         self.d.close()
         self.env.close()