Fix: sink.text.pretty: check that port is connected before creating message iterator
[babeltrace.git] / tests / plugins / sink.text.pretty / test_pretty.py
diff --git a/tests/plugins/sink.text.pretty/test_pretty.py b/tests/plugins/sink.text.pretty/test_pretty.py
new file mode 100644 (file)
index 0000000..368afb6
--- /dev/null
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2020 EfficiOS, Inc.
+
+import unittest
+import bt2
+
+
+class Test(unittest.TestCase):
+    # Test that the component returns an error if the graph is configured while
+    # the component's input port is left disconnected.
+    def test_unconnected_port_raises(self):
+        graph = bt2.Graph()
+        graph.add_component(
+            bt2.find_plugin('text').sink_component_classes['pretty'], 'snk'
+        )
+
+        with self.assertRaisesRegex(
+            bt2._Error, 'Single input port is not connected: port-name="in"'
+        ):
+            graph.run()
+
+
+if __name__ == '__main__':
+    unittest.main()
This page took 0.02273 seconds and 4 git commands to generate.