From a8e919abb82252e4647359cc9cdbc95cd4a5f18e Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont <nicolas@dandrimont.eu> Date: Wed, 4 Oct 2017 20:08:19 +0200 Subject: [PATCH] test_hashutil: remove temporary file after test --- swh/model/tests/test_hashutil.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/swh/model/tests/test_hashutil.py b/swh/model/tests/test_hashutil.py index c9f47e1e..1a4f24a6 100644 --- a/swh/model/tests/test_hashutil.py +++ b/swh/model/tests/test_hashutil.py @@ -4,6 +4,7 @@ # See top-level LICENSE file for more information import io +import os import tempfile import unittest @@ -92,8 +93,9 @@ class Hashutil(unittest.TestCase): def hash_path(self): with tempfile.NamedTemporaryFile(delete=False) as f: f.write(self.data) - f.close() - hashes = hashutil.hash_path(f.name) + + hashes = hashutil.hash_path(f.name) + os.remove(f.name) self.checksums['length'] = len(self.data) self.assertEquals(self.checksums, hashes) -- GitLab