From 28f302ca83461a9ea7ec38fa5686a8c0af5ce511 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20KUBLER?= <gregoire.kubler@proton.me>
Date: Mon, 15 Jul 2024 10:22:33 +0200
Subject: [PATCH] fix : check is now done without exception

---
 aidge_core/unit_tests/test_export.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/aidge_core/unit_tests/test_export.py b/aidge_core/unit_tests/test_export.py
index a0929eb96..b60304365 100644
--- a/aidge_core/unit_tests/test_export.py
+++ b/aidge_core/unit_tests/test_export.py
@@ -41,6 +41,10 @@ def initFiller(model):
                 pass
 
 def clean_dir(dir : pathlib.Path) -> None:
+    if not os.path.isdir(dir):
+        print(f"Error : directory {dir} doesn't exist.")
+        return
+
     for filename in os.listdir(dir):
         file_path = os.path.join(dir, filename)
         try:
@@ -83,7 +87,6 @@ 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"
-- 
GitLab