Skip to content

Commit

Permalink
Fix the cleanup so that we're not left with shelftemp.db.* files.
Browse files Browse the repository at this point in the history
This does nothing to fix the tests though...
  • Loading branch information
gvanrossum committed May 18, 2007
1 parent b5b2270 commit 8d9db04
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions Lib/test/test_shelve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down

0 comments on commit 8d9db04

Please sign in to comment.