| 1 | # SPDX-License-Identifier: GPL-2.0-only |
| 2 | # |
| 3 | # Copyright (C) 2020 EfficiOS, Inc. |
| 4 | |
| 5 | import unittest |
| 6 | |
| 7 | import bt2 |
| 8 | |
| 9 | |
| 10 | class Test(unittest.TestCase): |
| 11 | # Test that the component returns an error if the graph is configured while |
| 12 | # the component's input port is left disconnected. |
| 13 | def test_unconnected_port_raises(self): |
| 14 | graph = bt2.Graph() |
| 15 | graph.add_component( |
| 16 | bt2.find_plugin("text").sink_component_classes["pretty"], "snk" |
| 17 | ) |
| 18 | |
| 19 | with self.assertRaisesRegex( |
| 20 | bt2._Error, 'Single input port is not connected: port-name="in"' |
| 21 | ): |
| 22 | graph.run() |
| 23 | |
| 24 | |
| 25 | if __name__ == "__main__": |
| 26 | unittest.main() |