Browse Source

[Fix] #103 Fix neurotransmitter to wait an answer before launching the next one

monf 8 years ago
parent
commit
067d373b08
2 changed files with 7 additions and 5 deletions
  1. 6 5
      Tests/test_neuron_module.py
  2. 1 0
      kalliope/core/NeuronModule.py

+ 6 - 5
Tests/test_neuron_module.py

@@ -33,11 +33,12 @@ class TestNeuronModule(unittest.TestCase):
         """
 
         with mock.patch("kalliope.core.OrderListener.start") as mock_orderListener_start:
-            def callback():
-                pass
-            NeuronModule.get_audio_from_stt(callback=callback())
-            mock_orderListener_start.assert_called_once_with()
-            mock_orderListener_start.reset_mock()
+            with mock.patch("kalliope.core.OrderListener.join") as mock_orderListener_join:
+                def callback():
+                    pass
+                NeuronModule.get_audio_from_stt(callback=callback())
+                mock_orderListener_start.assert_called_once_with()
+                mock_orderListener_start.reset_mock()
 
     def test_update_cache_var(self):
         """

+ 1 - 0
kalliope/core/NeuronModule.py

@@ -240,6 +240,7 @@ class NeuronModule(object):
         # call the order listener
         ol = OrderListener(callback=callback)
         ol.start()
+        ol.join()
 
     def get_neuron_name(self):
         """