瀏覽代碼

[Tests] fix first time path is created

monf 8 年之前
父節點
當前提交
0c8a9181b8
共有 3 個文件被更改,包括 12 次插入2 次删除
  1. 2 0
      Tests/test_brain_loader.py
  2. 6 1
      Tests/test_tts_module.py
  3. 4 1
      neurons/script/tests/test_script.py

+ 2 - 0
Tests/test_brain_loader.py

@@ -3,7 +3,9 @@ import unittest
 from core.ConfigurationManager import BrainLoader
 from core.Models import Event
 from core.Models import Neuron
+from core.Models import Synapse
 from core.Models import Order
+from core.Models.Brain import Brain
 
 
 class TestBrainLoader(unittest.TestCase):

+ 6 - 1
Tests/test_tts_module.py

@@ -77,7 +77,10 @@ class TestTTSModule(unittest.TestCase):
 
             # with cache True and existing on system
             # create tmp file
-            file_path = "/tmp/kalliope/tests/TTSModule/tests/default/5c186d1e123be2667fb5fd54640e4fd0.tts"
+            tmp_base_path = "/tmp/kalliope/tests/TTSModule/tests/default/"
+            file_path = os.path.join(tmp_base_path, "5c186d1e123be2667fb5fd54640e4fd0.tts")
+            if not os.path.exists(tmp_base_path):
+                os.makedirs(tmp_base_path)
             FileManager.write_in_file(file_path, "[kalliope-test] test_generate_and_play")
             self.TTSMod.cache = True
             generate_audio_function_from_child = mock.Mock()
@@ -97,6 +100,8 @@ class TestTTSModule(unittest.TestCase):
         file_path = "/tmp/kalliope/tests/TTSModule/tests/default/5c186d1e123be2667fb5fd54640e4fd0.tts"
 
         # Create a tmp file
+        if not os.path.exists(base_cache_path):
+            os.makedirs(base_cache_path)
         tmp_path = os.path.join(base_cache_path, md5_word+".tts")
         FileManager.write_in_file(tmp_path, "[kalliope-test] test_is_file_already_in_cache")
 

+ 4 - 1
neurons/script/tests/test_script.py

@@ -40,7 +40,10 @@ class TestScript(unittest.TestCase):
 
         # Test Non executable file
         # Create the file and remove permissions to the user
-        tmp_file_path = "/tmp/kalliope/tests/neuronScript"
+        tmp_path = "/tmp/kalliope/tests/"
+        tmp_file_path = tmp_path+"neuronScript"
+        if not os.path.exists(tmp_path):
+            os.makedirs(tmp_path)
         FileManager.write_in_file(tmp_file_path, "[kalliope-test] TestScript - testParameters")
         os.chmod(tmp_file_path, 0600)
         # test the user does not have access