From 6bccaa958248dd80eab6bb4eeb31ddb51a4faf4a Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Thu, 4 Aug 2022 16:52:09 +0200 Subject: Use tempfile.TemporaryDirectory() instead of the old mkdtemp --- tests/test_derivatives.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tests/test_derivatives.py') diff --git a/tests/test_derivatives.py b/tests/test_derivatives.py index ec3ae65..ba9d79c 100644 --- a/tests/test_derivatives.py +++ b/tests/test_derivatives.py @@ -1,4 +1,3 @@ -import shutil import tempfile import unittest @@ -23,16 +22,16 @@ class Derivative(lesana.Collection): class testDerivatives(unittest.TestCase): def setUp(self): - self.tmpdir = tempfile.mkdtemp() + self.tmpdir = tempfile.TemporaryDirectory() utils.copytree( 'tests/data/derivative', - self.tmpdir, + self.tmpdir.name, dirs_exist_ok=True ) - self.collection = Derivative(self.tmpdir) + self.collection = Derivative(self.tmpdir.name) def tearDown(self): - shutil.rmtree(self.tmpdir) + self.tmpdir.cleanup() def test_load_subclasses(self): self.assertIsInstance(self.collection.fields['unknown'], DerivedType) -- cgit v1.2.3