Testing: use try/finally to ensure repo.json is always cleaned up
This commit is contained in:
@@ -31,11 +31,12 @@ class test_blenderpack_make_repo(unittest.TestCase):
|
|||||||
blenderpack.make_repo(self.helper_path / 'addons')
|
blenderpack.make_repo(self.helper_path / 'addons')
|
||||||
repojson = self.helper_path / 'addons' / 'repo.json'
|
repojson = self.helper_path / 'addons' / 'repo.json'
|
||||||
|
|
||||||
self.assertTrue(repojson.is_file())
|
try:
|
||||||
with repojson.open('r') as f:
|
with repojson.open('r') as f:
|
||||||
json.loads(f.read())
|
json.loads(f.read())
|
||||||
|
finally:
|
||||||
|
repojson.unlink()
|
||||||
|
|
||||||
os.remove(repojson)
|
|
||||||
self.fail('unfinished test')
|
self.fail('unfinished test')
|
||||||
|
|
||||||
def test_make_repo_from_nonexistent(self):
|
def test_make_repo_from_nonexistent(self):
|
||||||
|
Reference in New Issue
Block a user