summaryrefslogtreecommitdiff
path: root/tests/test_derivatives.py
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2022-08-04 16:52:09 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2022-08-04 16:57:51 +0200
commit6bccaa958248dd80eab6bb4eeb31ddb51a4faf4a (patch)
tree0bfee2a150f4018c636f86d7c94522f8d2a894bf /tests/test_derivatives.py
parent413d571e4ba5969020031c25d0048e49d581d525 (diff)
Use tempfile.TemporaryDirectory() instead of the old mkdtemp
Diffstat (limited to 'tests/test_derivatives.py')
-rw-r--r--tests/test_derivatives.py9
1 files changed, 4 insertions, 5 deletions
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)