Fixed leaking file descriptors in unit tests

These weren't any issue in Linux, but Windows doesn't like it when you
try to delete a still-opened file.
This commit is contained in:
Sybren A. Stüvel 2018-12-20 14:04:23 +01:00
parent fd316c4594
commit c331b99dc6
2 changed files with 3 additions and 0 deletions

View File

@ -17,5 +17,7 @@ class AbstractBlendFileTest(unittest.TestCase):
self.bf = None self.bf = None
def tearDown(self): def tearDown(self):
if self.bf is not None:
self.bf.close()
self.bf = None self.bf = None
blendfile.close_all_cached() blendfile.close_all_cached()

View File

@ -293,6 +293,7 @@ class BlendFileCacheTest(AbstractBlendFileTest):
self.tpath = pathlib.Path(self.tdir.name) self.tpath = pathlib.Path(self.tdir.name)
def tearDown(self): def tearDown(self):
super().tearDown()
self.tdir.cleanup() self.tdir.cleanup()
def test_open_cached(self): def test_open_cached(self):