Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(36107)

Unified Diff: Lib/test/test_bsddb185.py

Issue 5178: Add context manager for temporary directory
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/tempfile.py ('k') | Lib/test/test_bsddb3.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Lib/test/test_bsddb185.py
===================================================================
--- Lib/test/test_bsddb185.py (revision 69412)
+++ Lib/test/test_bsddb185.py (working copy)
@@ -11,7 +11,6 @@
import whichdb
import os
import tempfile
-import shutil
class Bsddb185Tests(unittest.TestCase):
@@ -27,14 +26,11 @@
def test_anydbm_create(self):
# Verify that anydbm.open does *not* create a bsddb185 file
- tmpdir = tempfile.mkdtemp()
- try:
+ with tempfile.TemporaryDirectory() as tmpdir:
dbfile = os.path.join(tmpdir, "foo.db")
anydbm.open(dbfile, "c").close()
ftype = whichdb.whichdb(dbfile)
self.assertNotEqual(ftype, "bsddb185")
- finally:
- shutil.rmtree(tmpdir)
def test_main():
run_unittest(Bsddb185Tests)
« no previous file with comments | « Lib/tempfile.py ('k') | Lib/test/test_bsddb3.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+