summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_shelve.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-18 21:57:09 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-18 21:57:09 (GMT)
commit8d9db047d2dde9a36197449bd66ea8b0dc42286d (patch)
treeaed001fdadb9c2a7cdf1bd9308f13d12909d7112 /Lib/test/test_shelve.py
parentb5b2270afbb1d8e0abc34e70230ca838a2d23548 (diff)
downloadcpython-8d9db047d2dde9a36197449bd66ea8b0dc42286d.zip
cpython-8d9db047d2dde9a36197449bd66ea8b0dc42286d.tar.gz
cpython-8d9db047d2dde9a36197449bd66ea8b0dc42286d.tar.bz2
Fix the cleanup so that we're not left with shelftemp.db.* files.
This does nothing to fix the tests though...
Diffstat (limited to 'Lib/test/test_shelve.py')
-rw-r--r--Lib/test/test_shelve.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/Lib/test/test_shelve.py b/Lib/test/test_shelve.py
index 447d06d..8e57121 100644
--- a/Lib/test/test_shelve.py
+++ b/Lib/test/test_shelve.py
@@ -8,35 +8,33 @@ class TestCase(unittest.TestCase):
fn = "shelftemp" + os.extsep + "db"
+ def tearDown(self):
+ for f in glob.glob(self.fn+"*"):
+ os.unlink(f)
+
def test_ascii_file_shelf(self):
+ s = shelve.open(self.fn, protocol=0)
try:
- s = shelve.open(self.fn, protocol=0)
s['key1'] = (1,2,3,4)
self.assertEqual(s['key1'], (1,2,3,4))
- s.close()
finally:
- for f in glob.glob(self.fn+"*"):
- os.unlink(f)
+ s.close()
def test_binary_file_shelf(self):
+ s = shelve.open(self.fn, protocol=1)
try:
- s = shelve.open(self.fn, protocol=1)
s['key1'] = (1,2,3,4)
self.assertEqual(s['key1'], (1,2,3,4))
- s.close()
finally:
- for f in glob.glob(self.fn+"*"):
- os.unlink(f)
+ s.close()
def test_proto2_file_shelf(self):
+ s = shelve.open(self.fn, protocol=2)
try:
- s = shelve.open(self.fn, protocol=2)
s['key1'] = (1,2,3,4)
self.assertEqual(s['key1'], (1,2,3,4))
- s.close()
finally:
- for f in glob.glob(self.fn+"*"):
- os.unlink(f)
+ s.close()
def test_in_memory_shelf(self):
d1 = {}