From 4762b8dcad84237a77e55ed857151a31bc3fa5b9 Mon Sep 17 00:00:00 2001
From: Stefano Borini <sborini@enthought.com>
Date: Mon, 21 May 2018 17:29:03 +0100
Subject: [PATCH] Added test for broken MCO communicator

---
 .../tests/test_core_evaluation_driver.py      | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/force_bdss/tests/test_core_evaluation_driver.py b/force_bdss/tests/test_core_evaluation_driver.py
index a749f0e..8c7d8f7 100644
--- a/force_bdss/tests/test_core_evaluation_driver.py
+++ b/force_bdss/tests/test_core_evaluation_driver.py
@@ -288,3 +288,23 @@ class TestCoreEvaluationDriver(unittest.TestCase):
         kpi_results = execute_workflow(wf, data_values)
         self.assertEqual(len(kpi_results), 1)
         self.assertEqual(kpi_results[0].value, 8750)
+
+    def test_mco_communicator_broken(self):
+        self.registry.mco_factories[0].raises_on_create_communicator = True
+        driver = CoreEvaluationDriver(
+            application=self.mock_application,
+        )
+
+        with testfixtures.LogCapture() as capture:
+            with self.assertRaises(Exception):
+                driver.application_started()
+            capture.check(
+                ('force_bdss.core_evaluation_driver', 'INFO',
+                 'Creating communicator'),
+                ("force_bdss.core_evaluation_driver",
+                 "ERROR",
+                 'Unable to create communicator from MCO factory '
+                 "'force.bdss.enthought.plugin.test.v0"
+                 ".factory.probe_mco' in plugin "
+                 "'force.bdss.enthought.plugin.test.v0'. "
+                 "This may indicate a programming error in the plugin"))
-- 
GitLab