Skip to content
Snippets Groups Projects
Commit 4934a2c2 authored by Grégoire Kubler's avatar Grégoire Kubler
Browse files

fix : build dir rm before test

parent 3d6a310a
No related branches found
No related tags found
2 merge requests!212Version 0.3.0,!116feat/release_pip
Pipeline #50917 failed
......@@ -10,14 +10,11 @@ SPDX-License-Identifier: EPL-2.0
import unittest
import aidge_core
from functools import reduce
import pathlib
import os
import sys
import subprocess
import shutil
import numpy as np
def initFiller(model):
# Initialize parameters (weights and biases)
......@@ -43,6 +40,17 @@ def initFiller(model):
else:
pass
def clean_dir(dir : pathlib.Path) -> None:
for filename in os.listdir(dir):
file_path = os.path.join(dir, filename)
try:
if os.path.isfile(file_path) or os.path.islink(file_path):
os.unlink(file_path)
elif os.path.isdir(file_path):
shutil.rmtree(file_path)
except Exception as e:
print('Failed to delete %s. Reason: %s' % (file_path, e))
return
class test_export(unittest.TestCase):
"""Test aidge export"""
......@@ -74,6 +82,9 @@ class test_export(unittest.TestCase):
# Export model
aidge_core.export(self.EXPORT_PATH, model)
clean_dir(self.EXPORT_PATH / "build")
self.assertTrue(
self.EXPORT_PATH.is_dir(), "Export folder has not been generated"
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment