Commit 40bbeeaa authored by Skip Montanaro's avatar Skip Montanaro

simpler temp dir cleanup

parent 419033e5
...@@ -11,6 +11,7 @@ import anydbm ...@@ -11,6 +11,7 @@ import anydbm
import whichdb import whichdb
import os import os
import tempfile import tempfile
import shutil
class Bsddb185Tests(unittest.TestCase): class Bsddb185Tests(unittest.TestCase):
...@@ -28,15 +29,12 @@ class Bsddb185Tests(unittest.TestCase): ...@@ -28,15 +29,12 @@ class Bsddb185Tests(unittest.TestCase):
# Verify that anydbm.open does *not* create a bsddb185 file # Verify that anydbm.open does *not* create a bsddb185 file
tmpdir = tempfile.mkdtemp() tmpdir = tempfile.mkdtemp()
try: try:
try: dbfile = os.path.join(tmpdir, "foo.db")
dbfile = os.path.join(tmpdir, "foo.db") anydbm.open(dbfile, "c").close()
anydbm.open(os.path.splitext(dbfile)[0], "c").close() ftype = whichdb.whichdb(dbfile)
ftype = whichdb.whichdb(dbfile) self.assertNotEqual(ftype, "bsddb185")
self.assertNotEqual(ftype, "bsddb185")
finally:
os.unlink(dbfile)
finally: finally:
os.rmdir(tmpdir) shutil.rmtree(tmpdir)
def test_main(): def test_main():
run_unittest(Bsddb185Tests) run_unittest(Bsddb185Tests)
......
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