Skip to content

Commit 2aed6b3

Browse files
committed
Use temporary directory
1 parent ea58d89 commit 2aed6b3

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

bpython/test/test_repl.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import collections
22
import inspect
33
import os
4-
import shutil
54
import socket
65
import sys
76
import tempfile
@@ -331,15 +330,11 @@ def setUp(self):
331330
self.repl.config.editor = "true"
332331

333332
def test_create_config(self):
334-
tmp_dir = tempfile.mkdtemp()
335-
try:
333+
with tempfile.TemporaryDirectory() as tmp_dir:
336334
config_path = Path(tmp_dir) / "newdir" / "config"
337335
self.repl.config.config_path = config_path
338336
self.repl.edit_config()
339337
self.assertTrue(os.path.exists(config_path))
340-
finally:
341-
shutil.rmtree(tmp_dir)
342-
self.assertFalse(os.path.exists(config_path))
343338

344339

345340
class TestRepl(unittest.TestCase):

0 commit comments

Comments
 (0)