Fixed file leak when opening corrupted file.

This commit is contained in:
Sybren A. Stüvel
2018-02-23 14:26:57 +01:00
parent eb8281ea82
commit 9750a91571
3 changed files with 13 additions and 6 deletions
Binary file not shown.
+5 -2
View File
@@ -1,6 +1,5 @@
import os
import pathlib
import unittest
from blender_asset_tracer import blendfile
from blender_asset_tracer.blendfile import iterators, exceptions
@@ -210,7 +209,11 @@ class LoadCompressedTest(AbstractBlendFileTest):
self.assertEqual('OBümlaut', name)
class LoadNonBlendfileTest(unittest.TestCase):
class LoadNonBlendfileTest(AbstractBlendFileTest):
def test_loading(self):
with self.assertRaises(exceptions.BlendFileError):
blendfile.BlendFile(pathlib.Path(__file__))
def test_no_datablocks(self):
with self.assertRaises(exceptions.NoDNA1Block):
blendfile.BlendFile(self.blendfiles / 'corrupt_only_magic.blend')